Perl::PrereqScanner::NotQuiteLite - a tool to scan your Perl code for its prerequisites
use Perl::PrereqScanner::NotQuiteLite; my $scanner = Perl::PrereqScanner::NotQuiteLite->new( parsers => [qw/:installed -UniversalVersion/], suggests => 1, ); my $context = $scanner->scan_file('path/to/file'); my $requirements = $context->requires; my $suggestions = $context->suggests; # requirements in evals
As of 0.49_01, the internal of this module was completely rewritten. I'm supposing there's no one who has written their own parsers for the previous version, but if this assumption was wrong, let me know.
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.
eval
creates a scanner object. Options are:
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).
use
require
no
base
parent
if
extends
with
If you need more, you can pass extra parser names to the scanner, or :installed, which loads and registers all the installed parsers under Perl::PrereqScanner::NotQuiteLite::Parser namespace.
:installed
Perl::PrereqScanner::NotQuiteLite::Parser
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.
-
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.
takes a path to a file and returns a ::Context object.
takes a string, scans and returns a ::Context object.
Perl::PrereqScanner, Perl::PrereqScanner::Lite, Module::ExtractUse
Kenichi Ishigaki, <ishigaki@cpan.org>
This software is copyright (c) 2015 by Kenichi Ishigaki.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Perl::PrereqScanner::NotQuiteLite, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perl::PrereqScanner::NotQuiteLite
CPAN shell
perl -MCPAN -e shell install Perl::PrereqScanner::NotQuiteLite
For more information on module installation, please visit the detailed CPAN module installation guide.