1Module::Loaded(3pm)    Perl Programmers Reference Guide    Module::Loaded(3pm)
2
3
4

NAME

6       Module::Loaded - mark modules as loaded or unloaded
7

SYNOPSIS

9           use Module::Loaded;
10
11           $bool = mark_as_loaded('Foo');   # Foo.pm is now marked as loaded
12           $loc  = is_loaded('Foo');        # location of Foo.pm set to the
13                                            # loaders location
14           eval "require 'Foo'";            # is now a no-op
15
16           $bool = mark_as_unloaded('Foo'); # Foo.pm no longer marked as loaded
17           eval "require 'Foo'";            # Will try to find Foo.pm in @INC
18

DESCRIPTION

20       When testing applications, often you find yourself needing to provide
21       functionality in your test environment that would usually be provided
22       by external modules. Rather than munging the %INC by hand to mark these
23       external modules as loaded, so they are not attempted to be loaded by
24       perl, this module offers you a very simple way to mark modules as
25       loaded and/or unloaded.
26

FUNCTIONS

28   $bool = mark_as_loaded( PACKAGE );
29       Marks the package as loaded to perl. "PACKAGE" can be a bareword or
30       string.
31
32       If the module is already loaded, "mark_as_loaded" will carp about this
33       and tell you from where the "PACKAGE" has been loaded already.
34
35   $bool = mark_as_unloaded( PACKAGE );
36       Marks the package as unloaded to perl, which is the exact opposite of
37       "mark_as_loaded". "PACKAGE" can be a bareword or string.
38
39       If the module is already unloaded, "mark_as_unloaded" will carp about
40       this and tell you the "PACKAGE" has been unloaded already.
41
42   $loc = is_loaded( PACKAGE );
43       "is_loaded" tells you if "PACKAGE" has been marked as loaded yet.
44       "PACKAGE" can be a bareword or string.
45
46       It returns falls if "PACKAGE" has not been loaded yet and the location
47       from where it is said to be loaded on success.
48

BUG REPORTS

50       Please report bugs or other issues to
51       <bug-module-loaded@rt.cpan.org<gt>.
52

AUTHOR

54       This module by Jos Boumans <kane@cpan.org>.
55
57       This library is free software; you may redistribute and/or modify it
58       under the same terms as Perl itself.
59
60
61
62perl v5.36.0                      2022-08-30               Module::Loaded(3pm)
Impressum