Module::Extract::VERSION - Extract a module version without running code
use Module::Extract::VERSION; my $version # just the version = Module::Extract::VERSION->parse_version_safely( $file ); my @version_info # extra info = Module::Extract::VERSION->parse_version_safely( $file );
This module lets you pull out of module source code the version number for the module. It assumes that there is only one $VERSION in the file.
$VERSION
Given a module file, return the module version. This works just like mldistwatch in PAUSE. It looks for the single line that has the $VERSION statement, extracts it, evals it, and returns the result.
mldistwatch
In scalar context, it returns just the version as a string. In list context, it returns the list of:
sigil fully-qualified variable name version value file name line number of $VERSION
This code is in Github:
git://github.com/briandfoy/module-extract-version.git
brian d foy, <bdfoy@cpan.org>
<bdfoy@cpan.org>
I stole the some of this code from mldistwatch in the PAUSE code by Andreas König, but I've moved most of it around.
Copyright (c) 2008-2011, brian d foy, All Rights Reserved.
You may redistribute this under the same terms as Perl itself.
To install Module::Extract::VERSION, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Module::Extract::VERSION
CPAN shell
perl -MCPAN -e shell install Module::Extract::VERSION
For more information on module installation, please visit the detailed CPAN module installation guide.