NAME

Module::Spec::V1 - Load modules based on specifications V1

VERSION

version 0.2.0

SYNOPSIS

use Module::Spec::V1 ();
Module::Spec::V1::need_module('Mango~2.3');

DESCRIPTION

MODULE SPECS

As string

M
M~V       minimum match, ≥ V
M~0       same as M, accepts any version

Example version specs are

2
2.3
2.3.4
v3.2.3

As a hash ref

{ M => V }      minimum match, ≥ V
{ M => '0' }    accepts any version

As an array ref

[ M ]
[ M => V ]      minimum match, ≥ V
[ M => '0' ]    same as [ M ], accepts any version

FUNCTIONS

Module::Spec::V1 implements the following functions.

need_module

$module = need_module('SomeModule~2.3');
$module = need_module( { SomeModule => '2.3' } );
$module = need_module( [ SomeModule => '2.3' ] );

Loads a module and checks for a version requirement (if any). Returns the name of the loaded module.

On list context, returns the name of the loaded module and its version (as reported by $m->VERSION).

( $m, $v ) = need_module($spec);

AUTHOR

Adriano Ferreira <ferreira@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Adriano Ferreira.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.