Alien-wxWidgets
view release on metacpan or search on metacpan
inc/inc_Module-Load-Conditional/Module/Load/Conditional.pm view on Meta::CPAN
$error = loc(q[Module '%1' is not uptodate!], $mod);
$CACHE->{$mod}->{usable} = 0;
last BLOCK;
}
}
} # BLOCK
if( defined $error ) {
$ERROR = $error;
Carp::carp( loc(q|%1 [THIS MAY BE A PROBLEM!]|,$error) ) if $args->{verbose};
return undef;
} else {
return 1;
}
}
=head2 @list = requires( MODULE );
C<requires> can tell you what other modules a particular module
requires. This is particularly useful when you're intending to write
a module for public release and are listing its prerequisites.
C<requires> takes but one argument: the name of a module.
It will then first check if it can actually load this module, and
return undef if it can't.
Otherwise, it will return a list of modules and pragmas that would
have been loaded on the module's behalf.
Note: The list C<require> returns has originated from your current
perl and your current install.
=cut
sub requires {
my $who = shift;
unless( check_install( module => $who ) ) {
warn loc(q[You do not have module '%1' installed], $who) if $VERBOSE;
return undef;
}
my $lib = join " ", map { qq["-I$_"] } @INC;
my $cmd = qq[$^X $lib -M$who -e"print(join(qq[\\n],keys(%INC)))"];
return sort
grep { !/^$who$/ }
map { chomp; s|/|::|g; $_ }
grep { s|\.pm$||i; }
`$cmd`;
}
1;
__END__
=head1 Global Variables
The behaviour of Module::Load::Conditional can be altered by changing the
following global variables:
=head2 $Module::Load::Conditional::VERBOSE
This controls whether Module::Load::Conditional will issue warnings and
explanations as to why certain things may have failed. If you set it
to 0, Module::Load::Conditional will not output any warnings.
The default is 0;
=head2 $Module::Load::Conditional::FIND_VERSION
This controls whether Module::Load::Conditional will try to parse
(and eval) the version from the module you're trying to load.
If you don't wish to do this, set this variable to C<false>. Understand
then that version comparisons are not possible, and Module::Load::Conditional
can not tell you what module version you have installed.
This may be desirable from a security or performance point of view.
Note that C<$FIND_VERSION> code runs safely under C<taint mode>.
The default is 1;
=head2 $Module::Load::Conditional::CHECK_INC_HASH
This controls whether C<Module::Load::Conditional> checks your
C<%INC> hash to see if a module is available. By default, only
C<@INC> is scanned to see if a module is physically on your
filesystem, or avialable via an C<@INC-hook>. Setting this variable
to C<true> will trust any entries in C<%INC> and return them for
you.
The default is 0;
=head2 $Module::Load::Conditional::CACHE
This holds the cache of the C<can_load> function. If you explicitly
want to remove the current cache, you can set this variable to
C<undef>
=head2 $Module::Load::Conditional::ERROR
This holds a string of the last error that happened during a call to
C<can_load>. It is useful to inspect this when C<can_load> returns
C<undef>.
=head1 See Also
C<Module::Load>
=head1 AUTHOR
This module by
Jos Boumans E<lt>kane@cpan.orgE<gt>.
=head1 COPYRIGHT
This module is copyright (c) 2002-2007 Jos Boumans
E<lt>kane@cpan.orgE<gt>. All rights reserved.
This library is free software; you may redistribute and/or modify
it under the same terms as Perl itself.
( run in 1.545 second using v1.01-cache-2.11-cpan-e93a5daba3e )