1Module::Loaded(3) User Contributed Perl Documentation Module::Loaded(3)
2
3
4
6 Module::Loaded -- mark modules as loaded or unloaded
7
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
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
28 $bool = mark_as_loaded( PACKAGE );
29
30 Marks the package as loaded to perl. "PACKAGE" can be a bareword or
31 string.
32
33 If the module is already loaded, "mark_as_loaded" will carp about this
34 and tell you from where the "PACKAGE" has been loaded already.
35
36 $bool = mark_as_unloaded( PACKAGE );
37
38 Marks the package as unloaded to perl, which is the exact opposite of
39 "mark_as_loaded". "PACKAGE" can be a bareword or string.
40
41 If the module is already unloaded, "mark_as_unloaded" will carp about
42 this and tell you the "PACKAGE" has been unloaded already.
43
44 $loc = is_loaded( PACKAGE );
45
46 "is_loaded" tells you if "PACKAGE" has been marked as loaded yet.
47 "PACKAGE" can be a bareword or string.
48
49 It returns falls if "PACKAGE" has not been loaded yet and the location
50 from where it is said to be loaded on success.
51
53 This module by Jos Boumans <kane@cpan.org>.
54
56 This module is copyright (c) 2004-2005 Jos Boumans <kane@cpan.org>.
57 All rights reserved.
58
59 This library is free software; you may redistribute and/or modify it
60 under the same terms as Perl itself.
61
62
63
64perl v5.8.8 2005-09-08 Module::Loaded(3)