You are viewing the version of this documentation from Perl 5.22.3. View the latest version

CONTENTS

NAME

Module::Load::Conditional - Looking up module information / loading at runtime

SYNOPSIS

use Module::Load::Conditional qw[can_load check_install requires];


my $use_list = {
        CPANPLUS        => 0.05,
        LWP             => 5.60,
        'Test::More'    => undef,
};

print can_load( modules => $use_list )
        ? 'all modules loaded successfully'
        : 'failed to load required modules';


my $rv = check_install( module => 'LWP', version => 5.60 )
            or print 'LWP is not installed!';

print 'LWP up to date' if $rv->{uptodate};
print "LWP version is $rv->{version}\n";
print "LWP is installed as file $rv->{file}\n";


print "LWP requires the following modules to be installed:\n";
print join "\n", requires('LWP');

### allow M::L::C to peek in your %INC rather than just
### scanning @INC
$Module::Load::Conditional::CHECK_INC_HASH = 1;

### reset the 'can_load' cache
undef $Module::Load::Conditional::CACHE;

### don't have Module::Load::Conditional issue warnings --
### default is '1'
$Module::Load::Conditional::VERBOSE = 0;

### The last error that happened during a call to 'can_load'
my $err = $Module::Load::Conditional::ERROR;