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

METHODS

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

BUGS

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

TO DO

127       Write lots more version checkers
128
129       - Perl 5.10 operators and language structures
130
131       - Three-argument open
132
133       Write the explicit version checker
134
135       Write the recursive module descend stuff
136
137       Check for more 5.12 features (currently only detecting "package NAME
138       VERSION;", "...", and "use feature ':5.12'")
139

SUPPORT

141       All bugs should be filed via the CPAN bug tracker at
142
143       <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Perl-MinimumVersion>
144
145       For other issues, or commercial enhancement or support, contact the
146       author.
147

AUTHORS

149       Adam Kennedy <adamk@cpan.org>
150

SEE ALSO

152       <http://ali.as/>, PPI, version
153
155       Copyright 2005 - 2013 Adam Kennedy.
156
157       This program is free software; you can redistribute it and/or modify it
158       under the same terms as Perl itself.
159
160       The full text of the license can be found in the LICENSE file included
161       with this module.
162
163
164
165perl v5.16.3                      2013-01-16           Perl::MinimumVersion(3)
Impressum