.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" 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 .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . 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 turned on, 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 .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Perl::MinimumVersion 3pm" .TH Perl::MinimumVersion 3pm "2014-08-22" "perl v5.20.0" "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 .SH "NAME" Perl::MinimumVersion \- Find a minimum required version of perl for Perl code .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& # Create the version checking object \& $object = Perl::MinimumVersion\->new( $filename ); \& $object = Perl::MinimumVersion\->new( \e$source ); \& $object = Perl::MinimumVersion\->new( $ppi_document ); \& \& # Find the minimum version \& $version = $object\->minimum_version; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\f(CW\*(C`Perl::MinimumVersion\*(C'\fR takes Perl source code and calculates the minimum version of perl required to be able to run it. Because it is based on \&\s-1PPI\s0, it can do this without having to actually load the code. .PP Currently it tests both the syntax of your code, and the use of explicit version dependencies such as \f(CW\*(C`require 5.005\*(C'\fR. .PP Future plans are to also add support for tracing module dependencies. .PP Using \f(CW\*(C`Perl::MinimumVersion\*(C'\fR is dead simple, the synopsis pretty much covers it. .PP The distribution comes with a script called perlver, which is the easiest way to run \f(CW\*(C`Perl::MinimumVersion\*(C'\fR on your code: .PP .Vb 1 \& % perlver lib/Foo/Bar.pm .Ve .PP See the documentation for perlver for more details. .SH "METHODS" .IX Header "METHODS" .SS "new" .IX Subsection "new" .Vb 4 \& # Create the version checking object \& $object = Perl::MinimumVersion\->new( $filename ); \& $object = Perl::MinimumVersion\->new( \e$source ); \& $object = Perl::MinimumVersion\->new( $ppi_document ); .Ve .PP The \f(CW\*(C`new\*(C'\fR constructor creates a new version checking object for a PPI::Document. You can also provide the document to be read as a file name, or as a \f(CW\*(C`SCALAR\*(C'\fR reference containing the code. .PP Returns a new \f(CW\*(C`Perl::MinimumVersion\*(C'\fR object, or \f(CW\*(C`undef\*(C'\fR on error. .SS "Document" .IX Subsection "Document" The \f(CW\*(C`Document\*(C'\fR accessor can be used to get the PPI::Document object back out of the version checker. .SS "minimum_version" .IX Subsection "minimum_version" The \f(CW\*(C`minimum_version\*(C'\fR method is the primary method for finding the minimum perl version required based on \f(CW\*(C`all\*(C'\fR factors in the document. .PP At the present time, this is just syntax and explicit version checks, as Perl::Depends is not yet completed. .PP Returns a version object, or \f(CW\*(C`undef\*(C'\fR on error. .SS "minimum_explicit_version" .IX Subsection "minimum_explicit_version" The \f(CW\*(C`minimum_explicit_version\*(C'\fR method checks through Perl code for the use of explicit version dependencies such as. .PP .Vb 2 \& use 5.006; \& require 5.005_03; .Ve .PP Although there is almost always only one of these in a file, if more than one are found, the highest version dependency will be returned. .PP Returns a version object, false if no dependencies could be found, or \f(CW\*(C`undef\*(C'\fR on error. .ie n .SS "minimum_syntax_version $limit" .el .SS "minimum_syntax_version \f(CW$limit\fP" .IX Subsection "minimum_syntax_version $limit" The \f(CW\*(C`minimum_syntax_version\*(C'\fR method will explicitly test only the Document's syntax to determine it's minimum version, to the extent that this is possible. .PP It takes an optional parameter of a version object defining the the lowest known current value. For example, if it is already known that it must be 5.006 or higher, then you can provide a param of qv(5.006) and the method will not run any of the tests below this version. This should provide dramatic speed improvements for large and/or complex documents. .PP The limitations of parsing Perl mean that this method may provide artifically low results, but should not artificially high results. .PP For example, if \f(CW\*(C`minimum_syntax_version\*(C'\fR returned 5.006, you can be confident it will not run on anything lower, although there is a chance that during actual execution it may use some untestable feature that creates a dependency on a higher version. .PP Returns a version object, false if no dependencies could be found, or \f(CW\*(C`undef\*(C'\fR on error. .SS "minimum_external_version" .IX Subsection "minimum_external_version" \&\fB\s-1WARNING:\s0 This method has not been implemented. Any attempted use will throw an exception\fR .PP The \f(CW\*(C`minimum_external_version\*(C'\fR examines code for dependencies on other external files, and recursively traverses the dependency tree applying the same tests to those files as it does to the original. .PP Returns a \f(CW\*(C`version\*(C'\fR object, false if no dependencies could be found, or \&\f(CW\*(C`undef\*(C'\fR on error. .SS "version_markers" .IX Subsection "version_markers" This method returns a list of pairs in the form: .PP .Vb 1 \& ($version, \e@markers) .Ve .PP Each pair represents all the markers that could be found indicating that the version was the minimum needed version. \f(CW@markers\fR is an array of strings. Currently, these strings are not as clear as they might be, but this may be changed in the future. In other words: don't rely on them as specific identifiers. .SH "BUGS" .IX Header "BUGS" \&\fBPerl::MinimumVersion\fR does a reasonable job of catching the best-known explicit version dependencies. .PP \&\fBHowever\fR it is exceedingly easy to add a new syntax check, so if you find something this is missing, copy and paste one of the existing 5 line checking functions, modify it to find what you want, and report it to rt.cpan.org, along with the version needed. .PP I don't even need an entire diff... just the function and version. .SH "TO DO" .IX Header "TO DO" \&\fBWrite lots more version checkers\fR .PP \&\- Perl 5.10 operators and language structures .PP \&\- Three-argument open .PP \&\fBWrite the explicit version checker\fR .PP \&\fBWrite the recursive module descend stuff\fR .PP _while_readdir for postfix while without brackets .PP \&\fBCheck for more 5.12 features (currently only detecting \&\f(CB\*(C`package NAME VERSION;\*(C'\fB, \f(CB\*(C`...\*(C'\fB, and \f(CB\*(C`use feature \*(Aq:5.12\*(Aq\*(C'\fB)\fR .SH "SUPPORT" .IX Header "SUPPORT" All bugs should be filed via the \s-1CPAN\s0 bug tracker at .PP .PP For other issues, or commercial enhancement or support, contact the author. .SH "AUTHORS" .IX Header "AUTHORS" Adam Kennedy .SH "SEE ALSO" .IX Header "SEE ALSO" perlver \- the command-line script for running \f(CW\*(C`Perl::MinimumVersion\*(C'\fR on your code. .PP Perl::MinimumVersion::Fast \- another module which does the same thing. It's a lot faster, but only supports Perl 5.8.1+. .PP , \s-1PPI\s0, version .SH "REPOSITORY" .IX Header "REPOSITORY" .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2005 \- 2014 Adam Kennedy. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP The full text of the license can be found in the \&\s-1LICENSE\s0 file included with this module.