1Module::Extract::VERSIOUNs(e3r)Contributed Perl DocumentMaotdiuolne::Extract::VERSION(3)
2
3
4
6 Module::Extract::VERSION - Extract a module version safely
7
9 use Module::Extract::VERSION;
10
11 my $version # just the version
12 = Module::Extract::VERSION->parse_version_safely( $file );
13
14 my @version_info # extra info
15 = Module::Extract::VERSION->parse_version_safely( $file );
16
18 This module lets you pull out of module source code the version number
19 for the module. It assumes that there is only one $VERSION in the file
20 and the entire $VERSION statement is on the same line.
21
22 Class methods
23 $class->parse_version_safely( FILE );
24 Given a module file, return the module version. This works just
25 like "mldistwatch" in PAUSE. It looks for the single line that has
26 the $VERSION statement, extracts it, evals it in a Safe
27 compartment, and returns the result.
28
29 In scalar context, it returns just the version as a string. In list
30 context, it returns the list of:
31
32 sigil
33 fully-qualified variable name
34 version value
35 file name
36 line number of $VERSION
37
39 This code is in Github:
40
41 https://github.com/briandfoy/module-extract-version.git
42
44 brian d foy, "<bdfoy@cpan.org>"
45
46 I stole the some of this code from "mldistwatch" in the PAUSE code by
47 Andreas König, but I've moved most of it around.
48
49 Andrey Starodubtsev added code to handle the v5.12 and v5.14 "package"
50 syntax.
51
53 Copyright © 2008-2021, brian d foy "<bdfoy@cpan.org>". All rights
54 reserved.
55
56 You may redistribute this under the Artistic License 2.0.
57
58
59
60perl v5.32.1 2021-01-27 Module::Extract::VERSION(3)