NAME

Perl::PrereqScanner::Lite - Lightweight Prereqs Scanner for Perl

SYNOPSIS

use Perl::PrereqScanner::Lite;

my $scanner = Perl::PrereqScanner::Lite->new;
$scanner->add_extra_scanner('Moose');
my $modules = $scanner->scan_file('path/to/file');

DESCRIPTION

Perl::PrereqScanner::Lite is the lightweight prereqs scanner for perl. This scanner uses Compiler::Lexer as tokenizer, therefore processing speed is really fast.

METHODS

  • new

    Create scanner instance.

  • scan_file($file_path)

    Scan and figure out prereqs by file path.

  • scan_string($string)

    Scan and figure out prereqs 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 by module name.

    e.g.

    my $modules = $scanner->scan_module('Perl::PrereqScanner::Lite');
  • scan_tokens($tokens)

    Scan and figure out prereqs by tokens of Compiler::Lexer.

    e.g.

    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.

    Now this module supports extra scanner for Moose families extends notation. Please see also Perl::PrereqScanner::Lite::Scanner::Moose.

SEE ALSO

Perl::PrereqScanner, Compiler::Lexer

LICENSE

Copyright (C) moznion.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

moznion <moznion@gmail.com>