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

Perl::PrereqScanner::NotQuiteLite - a tool to scan your Perl code for its prerequisites

Author

       Kenichi Ishigaki, <ishigaki@cpan.org>

Description

       Perl::PrereqScanner::NotQuiteLite is yet another prerequisites scanner. It passes almost all the scanning
       tests for Perl::PrereqScanner and Module::ExtractUse (ie. except for a few dubious ones), and runs
       slightly faster than PPI-based Perl::PrereqScanner. However, it doesn't run as fast as
       Perl::PrereqScanner::Lite (which uses an XS lexer).

       Perl::PrereqScanner::NotQuiteLite also recognizes "eval".  Prerequisites in "eval" are not considered as
       requirements, but you can collect them as suggestions.

       Conditional requirements or requirements loaded in a block are treated as recommends. Noed modules are
       stored separately (since 0.94).  You may or may not need to merge them into requires.

       Perl::PrereqScanner::NotQuiteLite can also recognize some of the new language features such as "say",
       subroutine signatures, and postfix dereferences, to improve the minimum perl requirement (since 0.9905).

Methods

new
       creates a scanner object. Options are:

       parsers
           By  default,  Perl::PrereqScanner::NotQuiteLite  only  recognizes  modules  loaded directly by "use",
           "require", "no" statements, plus modules loaded by a few common modules  such  as  "base",  "parent",
           "if"  (that  are  in  the  Perl  core),  and  by two keywords exported by Moose family ("extends" and
           "with").

           If you need more, you can pass extra parser names to the scanner,  or  ":bundled",  which  loads  and
           registers  all  the  parsers  bundled  with  this distribution. If you have your own parsers, you can
           specify ":installed" to load and register all the installed parsers.

           You    can    also    pass    a    project-specific     parser     (that     lies     outside     the
           "Perl::PrereqScanner::NotQuiteLite::Parser" namespace) by prepending "+" to the name.

             use Perl::PrereqScanner::NotQuiteLite;
             my $scanner = Perl::PrereqScanner::NotQuiteLite->new(
               parsers => [qw/+PrereqParser::For::MyProject/],
             );

           If you don't want to load a specific parser for some reason, prepend "-" to the parser name.

       suggests
           Perl::PrereqScanner::NotQuiteLite ignores "use"-like statements in "eval" by default. If you set this
           option  to  true,  Perl::PrereqScanner::NotQuiteLite  also  parses  statements in "eval", and records
           requirements as suggestions.

       recommends
           Perl::PrereqScanner::NotQuiteLite usually ignores "require"-like statements in a block by default. If
           you set this option to true, Perl::PrereqScanner::NotQuiteLite also records requirements in  a  block
           as recommendations.

       perl_minimum_version
           If  you set this option to true, Perl::PrereqScanner::NotQuiteLite adds a specific version of perl as
           a requirement when it finds some of the new perl language features.

   scan_file
       takes a path to a file and returns a ::Context object.

   scan_string
       takes a string, scans and returns a ::Context object.

Name

       Perl::PrereqScanner::NotQuiteLite - a tool to scan your Perl code for its prerequisites

See Also

       Perl::PrereqScanner, Perl::PrereqScanner::Lite, Module::ExtractUse

       Perl::PrereqScanner::NotQuiteLite::App to scan a whole distribution.

       scan-perl-prereqs-nqlite is a command line interface of the above.

Synopsis

         use Perl::PrereqScanner::NotQuiteLite;
         my $scanner = Perl::PrereqScanner::NotQuiteLite->new(
           parsers => [qw/:installed -UniversalVersion/],
           suggests => 1,
           perl_minimum_version => 1,
         );
         my $context = $scanner->scan_file('path/to/file');
         my $requirements = $context->requires;
         my $recommends = $context->recommends;
         my $suggestions  = $context->suggests; # requirements in evals
         my $noes = $context->noes;

See Also