Debian Codegraph @

upstream/mageia-cauldron/man3pm/Module::Loaded.3pm

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\"
56 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "Module::Loaded 3pm"
61 .TH Module::Loaded 3pm 2023-12-22 "perl v5.42.0" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 Module::Loaded \- mark modules as loaded or unloaded
68 .SH SYNOPSIS
69 .IX Header "SYNOPSIS"
70 .Vb 1
71 \& use Module::Loaded;
72 \&
73 \& $bool = mark_as_loaded(\*(AqFoo\*(Aq); # Foo.pm is now marked as loaded
74 \& $loc = is_loaded(\*(AqFoo\*(Aq); # location of Foo.pm set to the
75 \& # loaders location
76 \& eval "require \*(AqFoo\*(Aq"; # is now a no\-op
77 \&
78 \& $bool = mark_as_unloaded(\*(AqFoo\*(Aq); # Foo.pm no longer marked as loaded
79 \& eval "require \*(AqFoo\*(Aq"; # Will try to find Foo.pm in @INC
80 .Ve
81 .SH DESCRIPTION
82 .IX Header "DESCRIPTION"
83 When testing applications, often you find yourself needing to provide
84 functionality in your test environment that would usually be provided
85 by external modules. Rather than munging the \f(CW%INC\fR by hand to mark
86 these external modules as loaded, so they are not attempted to be loaded
87 by perl, this module offers you a very simple way to mark modules as
88 loaded and/or unloaded.
89 .SH FUNCTIONS
90 .IX Header "FUNCTIONS"
91 .ie n .SS "$bool = mark_as_loaded( PACKAGE );"
92 .el .SS "\f(CW$bool\fP = mark_as_loaded( PACKAGE );"
93 .IX Subsection "$bool = mark_as_loaded( PACKAGE );"
94 Marks the package as loaded to perl. \f(CW\*(C`PACKAGE\*(C'\fR can be a bareword or
95 string.
96 .PP
97 If the module is already loaded, \f(CW\*(C`mark_as_loaded\*(C'\fR will carp about
98 this and tell you from where the \f(CW\*(C`PACKAGE\*(C'\fR has been loaded already.
99 .ie n .SS "$bool = mark_as_unloaded( PACKAGE );"
100 .el .SS "\f(CW$bool\fP = mark_as_unloaded( PACKAGE );"
101 .IX Subsection "$bool = mark_as_unloaded( PACKAGE );"
102 Marks the package as unloaded to perl, which is the exact opposite
103 of \f(CW\*(C`mark_as_loaded\*(C'\fR. \f(CW\*(C`PACKAGE\*(C'\fR can be a bareword or string.
104 .PP
105 If the module is already unloaded, \f(CW\*(C`mark_as_unloaded\*(C'\fR will carp about
106 this and tell you the \f(CW\*(C`PACKAGE\*(C'\fR has been unloaded already.
107 .ie n .SS "$loc = is_loaded( PACKAGE );"
108 .el .SS "\f(CW$loc\fP = is_loaded( PACKAGE );"
109 .IX Subsection "$loc = is_loaded( PACKAGE );"
110 \&\f(CW\*(C`is_loaded\*(C'\fR tells you if \f(CW\*(C`PACKAGE\*(C'\fR has been marked as loaded yet.
111 \&\f(CW\*(C`PACKAGE\*(C'\fR can be a bareword or string.
112 .PP
113 It returns falls if \f(CW\*(C`PACKAGE\*(C'\fR has not been loaded yet and the location
114 from where it is said to be loaded on success.
115 .SH "BUG REPORTS"
116 .IX Header "BUG REPORTS"
117 Please report bugs or other issues to <bug\-module\[email protected]<gt>.
118 .SH AUTHOR
119 .IX Header "AUTHOR"
120 This module by Jos Boumans <[email protected]>.
121 .SH COPYRIGHT
122 .IX Header "COPYRIGHT"
123 This library is free software; you may redistribute and/or modify it
124 under the same terms as Perl itself.