NAME

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

SYNOPSIS

use Module::Extract::DeclaredMinimumPerl;

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

my $version = $extor->get_minimum_declared_perl( $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_minimum_declared_perl( 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_minimum_declared_perl.

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-declaredminimumperl

AUTHOR

brian d foy, <briandfoy@pobox.com>

COPYRIGHT AND LICENSE

Copyright © 2011-2023, brian d foy <briandfoy@pobox.com>. All rights reserved.

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