NAME

Module::Extract::DeclaredVersion - Extract the version of Perl a module declares

SYNOPSIS

use Module::Extract::DeclaredVersion;

my $extor = Module::Extract::DeclaredVersion->new;

my $version = $extor->get_declared_version( $file );
if( $extor->error ) { ... }

DESCRIPTION

Extract the largest declared Perl version and returns it as a version object. For instance, in a script you might have:

use v5.16;

This module will extract that v5.16 and return it.

This module tries to handle any format that PPI will recognize, passing them through version.pm to normalize them.

new

Makes an object. The object doesn't do anything just yet, but you need it to call the methods.

init

Set up the object. You shouldn't need to call this yourself. You can override it though!

get_declared_version( FILE )

Extracts all of the declared minimum versions for Perl, sorts them, and returns the largest a version object.

error

Return the error from the last call to get_modules.

TO DO

  • Make it recursive, so it scans the source for any module that it finds.

SEE ALSO

Module::Extract::Use

SOURCE AVAILABILITY

The source code is in Github

https://github.com/briandfoy/module-extract-declaredversion

AUTHOR

brian d foy, <bdfoy@cpan.org>

COPYRIGHT AND LICENSE

Copyright © 2011-2022, brian d foy <bdfoy@cpan.org>. All rights reserved.

You may redistribute this under the terms of the Artistic License 2.0.