Perl::PrereqScanner::Lite - Lightweight Prereqs Scanner for Perl
use Perl::PrereqScanner::Lite; my $scanner = Perl::PrereqScanner::Lite->new; $scanner->add_extra_scanner('Moose'); my $modules = $scanner->scan_file('path/to/file');
Perl::PrereqScanner::Lite is the lightweight prereqs scanner for perl. This scanner uses Compiler::Lexer as tokenizer, therefore processing speed is really fast.
new($opt)
Create scanner instance.
scan_file($file_path)
Scan and figure out prereqs which is instance of CPAN::Meta::Requirements by file path.
CPAN::Meta::Requirements
scan_string($string)
Scan and figure out prereqs which is instance of CPAN::Meta::Requirements by source code string written in perl.
e.g.
open my $fh, '<', __FILE__; my $string = do { local $/; <$fh> }; my $modules = $scanner->scan_string($string);
scan_module($module_name)
Scan and figure out prereqs which is instance of CPAN::Meta::Requirements by module name.
my $modules = $scanner->scan_module('Perl::PrereqScanner::Lite');
scan_tokens($tokens)
Scan and figure out prereqs which is instance of CPAN::Meta::Requirements by tokens of Compiler::Lexer.
open my $fh, '<', __FILE__; my $string = do { local $/; <$fh> }; my $tokens = Compiler::Lexer->new->tokenize($string); my $modules = $scanner->scan_tokens($tokens);
add_extra_scanner($scanner_name)
Add extra scanner to scan and figure out prereqs. This module loads extra scanner such as Perl::PrereqScanner::Lite::Scanner::$scanner_name if specifying scanner name through this method.
Perl::PrereqScanner::Lite::Scanner::$scanner_name
Extra scanners that are default supported are followings;
Perl::PrereqScanner::Lite::Scanner::Moose
Perl::PrereqScanner::Lite::Scanner::Version
If no_prereq is enabled by new() (like so: Perl::PrereqScanner::Lite->new({no_prereq => 1})), this module recognize ## no prereq optional comment. The requiring declaration with this comment on the same line will be ignored as prereq.
no_prereq
new()
Perl::PrereqScanner::Lite->new({no_prereq => 1})
## no prereq
For example
use Foo; use Bar; ## no prereq
In this case Foo is the prereq, however Bar is ignored.
Foo
Bar
Perl::PrereqScanner, Compiler::Lexer
Copyright (C) moznion.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
moznion <moznion@gmail.com>
To install Perl::PrereqScanner::Lite, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perl::PrereqScanner::Lite
CPAN shell
perl -MCPAN -e shell install Perl::PrereqScanner::Lite
For more information on module installation, please visit the detailed CPAN module installation guide.