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.024
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         my $prereqs = $scanner->scan_module( $module_name );
19

DESCRIPTION

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

PERL VERSION

51       This library should run on perls released even a long time ago.  It
52       should work on any version of perl released in the last five years.
53
54       Although it may work on older versions of perl, no guarantee is made
55       that the minimum required version will not be increased.  The version
56       may be increased for any reason, and there is no promise that patches
57       will be accepted to lower the minimum required perl.
58

METHODS

60   scan_string
61         my $prereqs = $scanner->scan_string( $perl_code );
62
63       Given a string containing Perl source code, this method returns a
64       CPAN::Meta::Requirements object describing the modules it requires.
65
66       This method will throw an exception if PPI fails to parse the code.
67
68       Warning!  It isn't entirely clear whether PPI prefers to receive
69       strings as octet strings or character strings.  For now, my advice is
70       to pass octet strings.
71
72   scan_file
73         my $prereqs = $scanner->scan_file( $path );
74
75       Given a file path to a Perl document, this method returns a
76       CPAN::Meta::Requirements object describing the modules it requires.
77
78       This method will throw an exception if PPI fails to parse the code.
79
80   scan_ppi_document
81         my $prereqs = $scanner->scan_ppi_document( $ppi_doc );
82
83       Given a PPI::Document, this method returns a CPAN::Meta::Requirements
84       object describing the modules it requires.
85
86   scan_module
87         my $prereqs = $scanner->scan_module( $module_name );
88
89       Given the name of a module, eg 'PPI::Document', this method returns a
90       CPAN::Meta::Requirements object describing the modules it requires.
91

SEE ALSO

93       scan-perl-prereqs, in this distribution, is a command-line interface to
94       the scanner
95

AUTHORS

97       •   Jerome Quelin
98
99       •   Ricardo Signes <rjbs@semiotic.systems>
100

CONTRIBUTORS

102       •   bowtie <bowtie@cpan.org>
103
104       •   celogeek <me@celogeek.com>
105
106       •   Christopher J. Madsen <perl@cjmweb.net>
107
108       •   David Golden <dagolden@cpan.org>
109
110       •   David Steinbrunner <dsteinbrunner@pobox.com>
111
112       •   Ed J <mohawk2@users.noreply.github.com>
113
114       •   Florian Ragwitz <rafl@debian.org>
115
116       •   Jakob Voss <voss@gbv.de>
117
118       •   Jérôme Quelin <jquelin@gmail.com>
119
120       •   John SJ Anderson <genehack@genehack.org>
121
122       •   Karen Etheridge <ether@cpan.org>
123
124       •   Mark Gardner <gardnerm@gsicommerce.com>
125
126       •   Neil Bowers <neil@bowers.com>
127
128       •   Randy Stauner <rwstauner@cpan.org>
129
130       •   Tina Mueller <tinita@cpan.org>
131
132       •   Vyacheslav Matjukhin <mmcleric@yandex-team.ru>
133
135       This software is copyright (c) 2009 by Jerome Quelin.
136
137       This is free software; you can redistribute it and/or modify it under
138       the same terms as the Perl 5 programming language system itself.
139
140
141
142perl v5.36.0                      2022-07-22            Perl::PrereqScanner(3)
Impressum