.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "Perl::PrereqScanner 3" .TH Perl::PrereqScanner 3 2026-06-28 "perl v5.42.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .Vb 1 \& my $prereqs = $scanner\->scan_string( $perl_code ); .Ve .PP Given a string containing Perl source code, this method returns a CPAN::Meta::Requirements object describing the modules it requires. .PP This method will throw an exception if PPI fails to parse the code. .PP \&\fBWarning!\fR It isn\*(Aqt entirely clear whether PPI prefers to receive strings as octet strings or character strings. For now, my advice is to pass octet strings. .PP .Vb 1 \& my $prereqs = $scanner\->scan_file( $path ); .Ve .PP Given a file path to a Perl document, this method returns a CPAN::Meta::Requirements object describing the modules it requires. .PP This method will throw an exception if PPI fails to parse the code. .PP .Vb 1 \& my $prereqs = $scanner\->scan_ppi_document( $ppi_doc ); .Ve .PP Given a PPI::Document, this method returns a CPAN::Meta::Requirements object describing the modules it requires. .PP .Vb 1 \& my $prereqs = $scanner\->scan_module( $module_name ); .Ve .PP Given the name of a module, eg \f(CW\*(AqPPI::Document\*(Aq\fR, this method returns a CPAN::Meta::Requirements object describing the modules it requires. .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 6 \& use Perl::PrereqScanner; \& my $scanner = Perl::PrereqScanner\->new; \& my $prereqs = $scanner\->scan_ppi_document( $ppi_doc ); \& my $prereqs = $scanner\->scan_file( $file_path ); \& my $prereqs = $scanner\->scan_string( $perl_code ); \& my $prereqs = $scanner\->scan_module( $module_name ); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" The scanner will extract loosely your distribution prerequisites from your files. .PP The extraction may not be perfect but tries to do its best. It will currently find the following prereqs: .SS "Scanner Plugins" .IX Subsection "Scanner Plugins" Perl::PrereqScanner works by running a series of scanners over a PPI::Document representing the code to scan. By default the "Perl5", "Moose", "TestMore", "POE", and "Aliased" scanners are run. You can supply your own scanners when constructing your PrereqScanner: .PP .Vb 2 \& # Us only the Perl5 scanner: \& my $scanner = Perl::PrereqScanner\->new({ scanners => [ qw(Perl5) ] }); \& \& # Use any stock scanners, plus Example: \& my $scanner = Perl::PrereqScanner\->new({ extra_scanners => [ qw(Example) ] }); .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" scan\-perl\-prereqs, in this distribution, is a command\-line interface to the scanner .SH "POD ERRORS" .IX Header "POD ERRORS" Hey! \fBThe above document had some coding errors, which are explained below:\fR .IP "Around line 56:" 4 .IX Item "Around line 56:" Unknown directive: =method .IP "Around line 79:" 4 .IX Item "Around line 79:" Unknown directive: =method .IP "Around line 99:" 4 .IX Item "Around line 99:" Unknown directive: =method .IP "Around line 120:" 4 .IX Item "Around line 120:" Unknown directive: =method