1Perl::MinimumVersion(3)User Contributed Perl DocumentatioPnerl::MinimumVersion(3)
2
3
4

NAME

6       Perl::MinimumVersion - Find a minimum required version of perl for Perl
7       code
8

SYNOPSIS

10         # Create the version checking object
11         $object = Perl::MinimumVersion->new( $filename );
12         $object = Perl::MinimumVersion->new( \$source  );
13         $object = Perl::MinimumVersion->new( $ppi_document );
14
15         # Find the minimum version
16         $version = $object->minimum_version;
17

DESCRIPTION

19       "Perl::MinimumVersion" takes Perl source code and calculates the
20       minimum version of perl required to be able to run it. Because it is
21       based on PPI, it can do this without having to actually load the code.
22
23       Currently it tests both the syntax of your code, and the use of
24       explicit version dependencies such as "require 5.005".
25
26       Future plans are to also add support for tracing module dependencies.
27
28       Using "Perl::MinimumVersion" is dead simple, the synopsis pretty much
29       covers it.
30
31       The distribution comes with a script called perlver, which is the
32       easiest way to run "Perl::MinimumVersion" on your code:
33
34        % perlver lib/Foo/Bar.pm
35
36       See the documentation for perlver for more details.
37

METHODS

39   new
40         # Create the version checking object
41         $object = Perl::MinimumVersion->new( $filename );
42         $object = Perl::MinimumVersion->new( \$source  );
43         $object = Perl::MinimumVersion->new( $ppi_document );
44
45       The "new" constructor creates a new version checking object for a
46       PPI::Document. You can also provide the document to be read as a file
47       name, or as a "SCALAR" reference containing the code.
48
49       Returns a new "Perl::MinimumVersion" object, or "undef" on error.
50
51   Document
52       The "Document" accessor can be used to get the PPI::Document object
53       back out of the version checker.
54
55   minimum_version
56       The "minimum_version" method is the primary method for finding the
57       minimum perl version required based on "all" factors in the document.
58
59       At the present time, this is just syntax and explicit version checks,
60       as Perl::Depends is not yet completed.
61
62       Returns a version object, or "undef" on error.
63
64   minimum_explicit_version
65       The "minimum_explicit_version" method checks through Perl code for the
66       use of explicit version dependencies such as.
67
68         use 5.006;
69         require 5.005_03;
70
71       Although there is almost always only one of these in a file, if more
72       than one are found, the highest version dependency will be returned.
73
74       Returns a version object, false if no dependencies could be found, or
75       "undef" on error.
76
77   minimum_syntax_version $limit
78       The "minimum_syntax_version" method will explicitly test only the
79       Document's syntax to determine it's minimum version, to the extent that
80       this is possible.
81
82       It takes an optional parameter of a version object defining the the
83       lowest known current value. For example, if it is already known that it
84       must be 5.006 or higher, then you can provide a param of qv(5.006) and
85       the method will not run any of the tests below this version. This
86       should provide dramatic speed improvements for large and/or complex
87       documents.
88
89       The limitations of parsing Perl mean that this method may provide
90       artifically low results, but should not artificially high results.
91
92       For example, if "minimum_syntax_version" returned 5.006, you can be
93       confident it will not run on anything lower, although there is a chance
94       that during actual execution it may use some untestable feature that
95       creates a dependency on a higher version.
96
97       Returns a version object, false if no dependencies could be found, or
98       "undef" on error.
99
100   minimum_external_version
101       WARNING: This method has not been implemented. Any attempted use will
102       throw an exception
103
104       The "minimum_external_version" examines code for dependencies on other
105       external files, and recursively traverses the dependency tree applying
106       the same tests to those files as it does to the original.
107
108       Returns a "version" object, false if no dependencies could be found, or
109       "undef" on error.
110
111   version_markers
112       This method returns a list of pairs in the form:
113
114         ($version, \@markers)
115
116       Each pair represents all the markers that could be found indicating
117       that the version was the minimum needed version.  @markers is an array
118       of strings.  Currently, these strings are not as clear as they might
119       be, but this may be changed in the future.  In other words: don't rely
120       on them as specific identifiers.
121

BUGS

123       Perl::MinimumVersion does a reasonable job of catching the best-known
124       explicit version dependencies.
125
126       However it is exceedingly easy to add a new syntax check, so if you
127       find something this is missing, copy and paste one of the existing 5
128       line checking functions, modify it to find what you want, and report it
129       to rt.cpan.org, along with the version needed.
130
131       I don't even need an entire diff... just the function and version.
132

TO DO

134       Write lots more version checkers
135
136       - Perl 5.10 operators and language structures
137
138       - Three-argument open
139
140       Write the explicit version checker
141
142       Write the recursive module descend stuff
143
144       _while_readdir for postfix while without brackets
145
146       Check for more 5.12 features (currently only detecting "package NAME
147       VERSION;", "...", and "use feature ':5.12'")
148

SUPPORT

150       All bugs should be filed via the CPAN bug tracker at
151
152       <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Perl-MinimumVersion>
153
154       For other issues, or commercial enhancement or support, contact the
155       author.
156

AUTHORS

158       Adam Kennedy <adamk@cpan.org>
159

SEE ALSO

161       perlver - the command-line script for running "Perl::MinimumVersion" on
162       your code.
163
164       Perl::MinimumVersion::Fast - another module which does the same thing.
165       It's a lot faster, but only supports Perl 5.8.1+.
166
167       <http://ali.as/>, PPI, version
168

REPOSITORY

170       <https://github.com/neilbowers/Perl-MinimumVersion>
171
173       Copyright 2005 - 2014 Adam Kennedy.
174
175       This program is free software; you can redistribute it and/or modify it
176       under the same terms as Perl itself.
177
178       The full text of the license can be found in the LICENSE file included
179       with this module.
180
181
182
183perl v5.32.0                      2020-07-28           Perl::MinimumVersion(3)
Impressum