logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Parse::PMFile - parses .pm file as PAUSE does

Author

       Andreas Koenig <andreas.koenig@anima.de>

       Kenichi Ishigaki, <ishigaki@cpan.org>

Description

       The most of the code of this module is taken from the PAUSE code as of April 2013 almost verbatim. Thus,
       the heart of this module should be quite stable. However, I made it not to use pipe ("-|") as well as I
       stripped database-related code. If you encounter any issue, that's most probably because of my
       modification.

       This module doesn't provide features to extract a distribution or parse meta files intentionally.

Methods

new
       creates an object. You can also pass a hashref taken from META.yml etc, and an optional hashref. Options
       are:

       ALLOW_DEV_VERSION
           Parse::PMFile  usually  ignores  a  version  with  an  underscore  as  PAUSE does (because it's for a
           developer release, and should not be indexed). Set this option to true if you happen to need to  keep
           such a version for better analysis.

       VERBOSE
           Set this to true if you need to know some details.

       FORK
           As  of  version  0.17,  Parse::PMFile  stops  forking while parsing a version for better performance.
           Parse::PMFile should return the same result no matter how this option is set, but if you do care, set
           this to true to fork as PAUSE does.

       USERID, PERMISSIONS
           As of version 0.21, Parse::PMFile checks permissions of a package  if  both  USERID  and  PERMISSIONS
           (which should be an instance of PAUSE::Permissions) are provided. Unauthorized packages are removed.

       UNSAFE
           Parse::PMFile  usually  parses a module version in a Safe compartment. However, this approach doesn't
           work smoothly under older perls (prior to 5.10) plus some combinations of recent versions of  Safe.pm
           (2.24  and  above)  and  version.pm  (0.9905  and  above)  for  various  reasons. As of version 0.27,
           Parse::PMFile simply uses "eval" to parse a version under older perls. If you want it to  use  always
           "eval" (even under recent perls), set this to true.

   parse
       takes  a  path to a .pm file, and returns a hash reference that holds information for package(s) found in
       the file.

Name

       Parse::PMFile - parses .pm file as PAUSE does

Pod Errors

       Hey! Theabovedocumenthadsomecodingerrors,whichareexplainedbelow:

       Around line 381:
           =pod directives shouldn't be over one line long!  Ignoring all 10 lines of content

perl v5.38.2                                       2024-05-08                                 Parse::PMFile(3pm)

See Also

       Parse::LocalDistribution, PAUSE::Permissions

       Most part of this module is derived from PAUSE and CPAN::Version.

       <https://github.com/andk/pause>

       <https://github.com/andk/cpanpm>

Synopsis

           use Parse::PMFile;

           my $parser = Parse::PMFile->new($metadata, {VERBOSE => 1});
           my $packages_info = $parser->parse($pmfile);

           # if you need info about invalid versions
           my ($packages_info, $errors) = $parser->parse($pmfile);

           # to check permissions
           my $parser = Parse::PMFile->new($metadata, {
               USERID => 'ISHIGAKI',
               PERMISSIONS => PAUSE::Permissions->new,
           });

See Also