1CPAN::ParseDistributionU(s3e)r Contributed Perl DocumentaCtPiAoNn::ParseDistribution(3)
2
3
4
6 CPAN::ParseDistribution - index a file from the BackPAN
7
9 Given a file from the BackPAN, this will let you find out what versions
10 of what modules it contains, the distribution name and version
11
13 my $dist = CPAN::ParseDistribution->new(
14 'A/AU/AUTHORID/subdirectory/Some-Distribution-1.23.tar.gz',
15 use_tar => '/bin/tar',
16 ...
17 );
18 my $modules = $dist->modules(); # hashref of modname => version
19 my $distname = $dist->dist();
20 my $distversion = $dist->distversion();
21
23 new
24 Constructor, takes a single mandatory argument, which should be a
25 tarball or zip file from the CPAN or BackPAN, and some optional named
26 arguments:
27
28 use_tar
29 The full path to 'tar'. This is assumed to be GNU tar, and to be
30 sufficiently well-endowed as to be able to support bzip2 files.
31 Maybe I'll fix that at some point. If this isn't specified, then
32 Archive::Tar is used instead.
33
34 You might want to use this if dealing with very large files, as
35 Archive::Tar is rather profligate with memory.
36
37 isdevversion
38 Returns true or false depending on whether this is a developer-only or
39 trial release of a distribution. This is determined by looking for an
40 underscore in the distribution version or the string '-TRIAL' at the
41 end of the distribution version.
42
43 modules
44 Returns a hashref whose keys are module names, and their values are the
45 versions of the modules. The version number is retrieved by eval()ing
46 what looks like a $VERSION line in the code. This is done in a "Safe"
47 compartment, but may be a security risk if you do this with untrusted
48 code. Caveat user!
49
50 dist
51 Return the name of the distribution. eg, in the synopsis above, it
52 would return 'Some-Distribution'.
53
54 distversion
55 Return the version of the distribution. eg, in the synopsis above, it
56 would return 1.23.
57
58 Strictly speaking, the CPAN doesn't have distribution versions -
59 Foo-Bar-1.23.tar.gz is not considered to have any relationship to
60 Foo-Bar-1.24.tar.gz, they just happen to coincidentally have rather
61 similar contents. But other tools, such as those used by the CPAN
62 testers, do treat distributions as being versioned.
63
65 This module executes a very small amount of code from each module that
66 it finds in a distribution. While every effort has been made to do
67 this safely, there are no guarantees that it won't let the
68 distributions you're examining do horrible things to your machine, such
69 as email your password file to strangers. You are strongly advised to
70 read the source code and to run it in a very heavily restricted user
71 account.
72
74 I welcome feedback about my code, including constructive criticism.
75 Bug reports should be made using Github Issues
76 <https://github.com/DrHyde/perl-modules-CPAN-ParseDistribution/issues>
77 and should include the smallest possible chunk of code, along with any
78 necessary data, which demonstrates the bug. Ideally, this will be in
79 the form of files which I can drop in to the module's test suite.
80
81 There is a known problem with parsing some pathological distributions
82 on Windows, where CPAN::ParseDistribution may either hang or crash.
83 This is because Windows doesn't properly support fork()ing and signals.
84 I can not fix this, but welcome patches with tests.
85
87 <http://pause.perl.org/>
88
89 dumpcpandist
90
92 Copyright 2009-2011 David Cantrell <david@cantrell.org.uk>
93
94 Contains code originally from the PAUSE by Andreas Koenig.
95
96 This software is free-as-in-speech software, and may be used,
97 distributed, and modified under the terms of either the GNU General
98 Public Licence version 2 or the Artistic Licence. It's up to you which
99 one you use. The full text of the licences can be found in the files
100 GPL2.txt and ARTISTIC.txt, respectively.
101
103 This module is also free-as-in-mason software.
104
105
106
107perl v5.30.1 2020-01-29 CPAN::ParseDistribution(3)