1Perl::PrereqScanner(3)User Contributed Perl DocumentationPerl::PrereqScanner(3)
2
3
4

NAME

6       Perl::PrereqScanner - a tool to scan your Perl code for its
7       prerequisites
8

VERSION

10       version 1.008
11

SYNOPSIS

13         use Perl::PrereqScanner;
14         my $scanner = Perl::PrereqScanner->new;
15         my $prereqs = $scanner->scan_ppi_document( $ppi_doc );
16         my $prereqs = $scanner->scan_file( $file_path );
17         my $prereqs = $scanner->scan_string( $perl_code );
18

DESCRIPTION

20       The scanner will extract loosely your distribution prerequisites from
21       your files.
22
23       The extraction may not be perfect but tries to do its best. It will
24       currently find the following prereqs:
25
26       ·   plain lines beginning with "use" or "require" in your perl modules
27           and scripts, including minimum perl version
28
29       ·   regular inheritance declared with the "base" and "parent" pragmata
30
31       ·   Moose inheritance declared with the "extends" keyword
32
33       ·   Moose roles included with the "with" keyword
34
35       ·   OO namespace aliasing using the "aliased" module
36
37   Scanner Plugins
38       Perl::PrereqScanner works by running a series of scanners over a
39       PPI::Document representing the code to scan.  By default the "Perl5",
40       "Moose", "TestMore", "POE", and "Aliased" scanners are run.  You can
41       supply your own scanners when constructing your PrereqScanner:
42
43         # Us only the Perl5 scanner:
44         my $scanner = Perl::PrereqScanner->new({ plugins => [ qw(Perl5) ] });
45
46         # Use any stock plugins, plus Example:
47         my $scanner = Perl::PrereqScanner->new({ extra_plugins => [ qw(Example) ] });
48

METHODS

50   scan_string
51         my $prereqs = $scanner->scan_string( $perl_code );
52
53       Given a string containing Perl source code, this method returns a
54       Version::Requirements object describing the modules it requires.
55
56       This method will throw an exception if PPI fails to parse the code.
57
58   scan_file
59         my $prereqs = $scanner->scan_file( $path );
60
61       Given a file path to a Perl document, this method returns a
62       Version::Requirements object describing the modules it requires.
63
64       This method will throw an exception if PPI fails to parse the code.
65
66   scan_ppi_document
67         my $prereqs = $scanner->scan_ppi_document( $ppi_doc );
68
69       Given a PPI::Document, this method returns a Version::Requirements
70       object describing the modules it requires.
71

AUTHORS

73       ·   Jerome Quelin
74
75       ·   Ricardo Signes <rjbs@cpan.org>
76
78       This software is copyright (c) 2009 by Jerome Quelin.
79
80       This is free software; you can redistribute it and/or modify it under
81       the same terms as the Perl 5 programming language system itself.
82
83
84
85perl v5.12.4                      2011-11-01            Perl::PrereqScanner(3)
Impressum