Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

module::loaded(3perl) [debian man page]

Module::Loaded(3perl)					 Perl Programmers Reference Guide				     Module::Loaded(3perl)

NAME
Module::Loaded - mark modules as loaded or unloaded SYNOPSIS
use Module::Loaded; $bool = mark_as_loaded('Foo'); # Foo.pm is now marked as loaded $loc = is_loaded('Foo'); # location of Foo.pm set to the # loaders location eval "require 'Foo'"; # is now a no-op $bool = mark_as_unloaded('Foo'); # Foo.pm no longer marked as loaded eval "require 'Foo'"; # Will try to find Foo.pm in @INC DESCRIPTION
When testing applications, often you find yourself needing to provide functionality in your test environment that would usually be provided by external modules. Rather than munging the %INC by hand to mark these external modules as loaded, so they are not attempted to be loaded by perl, this module offers you a very simple way to mark modules as loaded and/or unloaded. FUNCTIONS
$bool = mark_as_loaded( PACKAGE ); Marks the package as loaded to perl. "PACKAGE" can be a bareword or string. If the module is already loaded, "mark_as_loaded" will carp about this and tell you from where the "PACKAGE" has been loaded already. $bool = mark_as_unloaded( PACKAGE ); Marks the package as unloaded to perl, which is the exact opposite of "mark_as_loaded". "PACKAGE" can be a bareword or string. If the module is already unloaded, "mark_as_unloaded" will carp about this and tell you the "PACKAGE" has been unloaded already. $loc = is_loaded( PACKAGE ); "is_loaded" tells you if "PACKAGE" has been marked as loaded yet. "PACKAGE" can be a bareword or string. It returns falls if "PACKAGE" has not been loaded yet and the location from where it is said to be loaded on success. BUG REPORTS
Please report bugs or other issues to <bug-module-loaded@rt.cpan.org<gt>. AUTHOR
This module by Jos Boumans <kane@cpan.org>. COPYRIGHT
This library is free software; you may redistribute and/or modify it under the same terms as Perl itself. perl v5.14.2 2010-12-30 Module::Loaded(3perl)

Check Out this Related Man Page

Module::Load(3perl)					 Perl Programmers Reference Guide				       Module::Load(3perl)

NAME
Module::Load - runtime require of both modules and files SYNOPSIS
use Module::Load; my $module = 'Data:Dumper'; load Data::Dumper; # loads that module load 'Data::Dumper'; # ditto load $module # tritto my $script = 'some/script.pl' load $script; load 'some/script.pl'; # use quotes because of punctuations load thing; # try 'thing' first, then 'thing.pm' load CGI, ':standard' # like 'use CGI qw[:standard]' DESCRIPTION
"load" eliminates the need to know whether you are trying to require either a file or a module. If you consult "perldoc -f require" you will see that "require" will behave differently when given a bareword or a string. In the case of a string, "require" assumes you are wanting to load a file. But in the case of a bareword, it assumes you mean a module. This gives nasty overhead when you are trying to dynamically require modules at runtime, since you will need to change the module notation ("Acme::Comment") to a file notation fitting the particular platform you are on. "load" eliminates the need for this overhead and will just DWYM. Rules "load" has the following rules to decide what it thinks you want: o If the argument has any characters in it other than those matching "w", ":" or "'", it must be a file o If the argument matches only "[w:']", it must be a module o If the argument matches only "w", it could either be a module or a file. We will try to find "file.pm" first in @INC and if that fails, we will try to find "file" in @INC. If both fail, we die with the respective error messages. Caveats Because of a bug in perl (#19213), at least in version 5.6.1, we have to hardcode the path separator for a require on Win32 to be "/", like on Unix rather than the Win32 "". Otherwise perl will not read its own %INC accurately double load files if they are required again, or in the worst case, core dump. "Module::Load" cannot do implicit imports, only explicit imports. (in other words, you always have to specify explicitly what you wish to import from a module, even if the functions are in that modules' @EXPORT) ACKNOWLEDGEMENTS
Thanks to Jonas B. Nielsen for making explicit imports work. BUG REPORTS
Please report bugs or other issues to <bug-module-load@rt.cpan.org<gt>. AUTHOR
This module by Jos Boumans <kane@cpan.org>. COPYRIGHT
This library is free software; you may redistribute and/or modify it under the same terms as Perl itself. perl v5.14.2 2011-09-26 Module::Load(3perl)
Man Page