1Parse::PMFile(3) User Contributed Perl Documentation Parse::PMFile(3)
2
3
4
6 Parse::PMFile - parses .pm file as PAUSE does
7
9 use Parse::PMFile;
10
11 my $parser = Parse::PMFile->new($metadata, {VERBOSE => 1});
12 my $packages_info = $parser->parse($pmfile);
13
14 # if you need info about invalid versions
15 my ($packages_info, $errors) = $parser->parse($pmfile);
16
17 # to check permissions
18 my $parser = Parse::PMFile->new($metadata, {
19 USERID => 'ISHIGAKI',
20 PERMISSIONS => PAUSE::Permissions->new,
21 });
22
24 The most of the code of this module is taken from the PAUSE code as of
25 April 2013 almost verbatim. Thus, the heart of this module should be
26 quite stable. However, I made it not to use pipe ("-|") as well as I
27 stripped database-related code. If you encounter any issue, that's most
28 probably because of my modification.
29
30 This module doesn't provide features to extract a distribution or parse
31 meta files intentionally.
32
34 new
35 creates an object. You can also pass a hashref taken from META.yml etc,
36 and an optional hashref. Options are:
37
38 ALLOW_DEV_VERSION
39 Parse::PMFile usually ignores a version with an underscore as PAUSE
40 does (because it's for a developer release, and should not be
41 indexed). Set this option to true if you happen to need to keep
42 such a version for better analysis.
43
44 VERBOSE
45 Set this to true if you need to know some details.
46
47 FORK
48 As of version 0.17, Parse::PMFile stops forking while parsing a
49 version for better performance. Parse::PMFile should return the
50 same result no matter how this option is set, but if you do care,
51 set this to true to fork as PAUSE does.
52
53 USERID, PERMISSIONS
54 As of version 0.21, Parse::PMFile checks permissions of a package
55 if both USERID and PERMISSIONS (which should be an instance of
56 PAUSE::Permissions) are provided. Unauthorized packages are
57 removed.
58
59 UNSAFE
60 Parse::PMFile usually parses a module version in a Safe
61 compartment. However, this approach doesn't work smoothly under
62 older perls (prior to 5.10) plus some combinations of recent
63 versions of Safe.pm (2.24 and above) and version.pm (0.9905 and
64 above) for various reasons. As of version 0.27, Parse::PMFile
65 simply uses "eval" to parse a version under older perls. If you
66 want it to use always "eval" (even under recent perls), set this to
67 true.
68
69 parse
70 takes a path to a .pm file, and returns a hash reference that holds
71 information for package(s) found in the file.
72
74 Parse::LocalDistribution, PAUSE::Permissions
75
76 Most part of this module is derived from PAUSE and CPAN::Version.
77
78 <https://github.com/andk/pause>
79
80 <https://github.com/andk/cpanpm>
81
83 Andreas Koenig <andreas.koenig@anima.de>
84
85 Kenichi Ishigaki, <ishigaki@cpan.org>
86
88 Copyright 1995 - 2013 by Andreas Koenig <andk@cpan.org> for most of the
89 code.
90
91 Copyright 2013 by Kenichi Ishigaki for some.
92
93 This program is free software; you can redistribute it and/or modify it
94 under the same terms as Perl itself.
95
96
97
98perl v5.32.1 2021-01-27 Parse::PMFile(3)