Install Perl 5.8.8
[msysgit.git] / mingw / html / lib / warnings.html
bloba816064702d8335acb6fade81e535685971c9076
1 <?xml version="1.0" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <title>warnings - Perl pragma to control optional warnings</title>
6 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
7 <link rev="made" href="mailto:" />
8 </head>
10 <body style="background-color: white">
11 <table border="0" width="100%" cellspacing="0" cellpadding="3">
12 <tr><td class="block" style="background-color: #cccccc" valign="middle">
13 <big><strong><span class="block">&nbsp;warnings - Perl pragma to control optional warnings</span></strong></big>
14 </td></tr>
15 </table>
17 <p><a name="__index__"></a></p>
18 <!-- INDEX BEGIN -->
20 <ul>
22 <li><a href="#name">NAME</a></li>
23 <li><a href="#synopsis">SYNOPSIS</a></li>
24 <li><a href="#description">DESCRIPTION</a></li>
25 </ul>
26 <!-- INDEX END -->
28 <hr />
29 <p>
30 </p>
31 <h1><a name="name">NAME</a></h1>
32 <p>warnings - Perl pragma to control optional warnings</p>
33 <p>
34 </p>
35 <hr />
36 <h1><a name="synopsis">SYNOPSIS</a></h1>
37 <pre>
38 use warnings;
39 no warnings;</pre>
40 <pre>
41 use warnings &quot;all&quot;;
42 no warnings &quot;all&quot;;</pre>
43 <pre>
44 use warnings::register;
45 if (warnings::enabled()) {
46 warnings::warn(&quot;some warning&quot;);
47 }</pre>
48 <pre>
49 if (warnings::enabled(&quot;void&quot;)) {
50 warnings::warn(&quot;void&quot;, &quot;some warning&quot;);
51 }</pre>
52 <pre>
53 if (warnings::enabled($object)) {
54 warnings::warn($object, &quot;some warning&quot;);
55 }</pre>
56 <pre>
57 warnings::warnif(&quot;some warning&quot;);
58 warnings::warnif(&quot;void&quot;, &quot;some warning&quot;);
59 warnings::warnif($object, &quot;some warning&quot;);</pre>
60 <p>
61 </p>
62 <hr />
63 <h1><a name="description">DESCRIPTION</a></h1>
64 <p>The <code>warnings</code> pragma is a replacement for the command line flag <code>-w</code>,
65 but the pragma is limited to the enclosing block, while the flag is global.
66 See <a href="file://C|\msysgit\mingw\html/pod/perllexwarn.html">the perllexwarn manpage</a> for more information.</p>
67 <p>If no import list is supplied, all possible warnings are either enabled
68 or disabled.</p>
69 <p>A number of functions are provided to assist module authors.</p>
70 <dl>
71 <dt><strong><a name="item_use_warnings_3a_3aregister">use warnings::register</a></strong>
73 <dd>
74 <p>Creates a new warnings category with the same name as the package where
75 the call to the pragma is used.</p>
76 </dd>
77 </li>
78 <dt><strong><a name="item_enabled">warnings::enabled()</a></strong>
80 <dd>
81 <p>Use the warnings category with the same name as the current package.</p>
82 </dd>
83 <dd>
84 <p>Return TRUE if that warnings category is enabled in the calling module.
85 Otherwise returns FALSE.</p>
86 </dd>
87 </li>
88 <dt><strong>warnings::enabled($category)</strong>
90 <dd>
91 <p>Return TRUE if the warnings category, <code>$category</code>, is enabled in the
92 calling module.
93 Otherwise returns FALSE.</p>
94 </dd>
95 </li>
96 <dt><strong>warnings::enabled($object)</strong>
98 <dd>
99 <p>Use the name of the class for the object reference, <code>$object</code>, as the
100 warnings category.</p>
101 </dd>
102 <dd>
103 <p>Return TRUE if that warnings category is enabled in the first scope
104 where the object is used.
105 Otherwise returns FALSE.</p>
106 </dd>
107 </li>
108 <dt><strong><a name="item_warn">warnings::warn($message)</a></strong>
110 <dd>
111 <p>Print <code>$message</code> to STDERR.</p>
112 </dd>
113 <dd>
114 <p>Use the warnings category with the same name as the current package.</p>
115 </dd>
116 <dd>
117 <p>If that warnings category has been set to ``FATAL'' in the calling module
118 then die. Otherwise return.</p>
119 </dd>
120 </li>
121 <dt><strong>warnings::warn($category, $message)</strong>
123 <dd>
124 <p>Print <code>$message</code> to STDERR.</p>
125 </dd>
126 <dd>
127 <p>If the warnings category, <code>$category</code>, has been set to ``FATAL'' in the
128 calling module then die. Otherwise return.</p>
129 </dd>
130 </li>
131 <dt><strong>warnings::warn($object, $message)</strong>
133 <dd>
134 <p>Print <code>$message</code> to STDERR.</p>
135 </dd>
136 <dd>
137 <p>Use the name of the class for the object reference, <code>$object</code>, as the
138 warnings category.</p>
139 </dd>
140 <dd>
141 <p>If that warnings category has been set to ``FATAL'' in the scope where <code>$object</code>
142 is first used then die. Otherwise return.</p>
143 </dd>
144 </li>
145 <dt><strong><a name="item_warnif">warnings::warnif($message)</a></strong>
147 <dd>
148 <p>Equivalent to:</p>
149 </dd>
150 <dd>
151 <pre>
152 if (warnings::enabled())
153 { warnings::warn($message) }</pre>
154 </dd>
155 </li>
156 <dt><strong>warnings::warnif($category, $message)</strong>
158 <dd>
159 <p>Equivalent to:</p>
160 </dd>
161 <dd>
162 <pre>
163 if (warnings::enabled($category))
164 { warnings::warn($category, $message) }</pre>
165 </dd>
166 </li>
167 <dt><strong>warnings::warnif($object, $message)</strong>
169 <dd>
170 <p>Equivalent to:</p>
171 </dd>
172 <dd>
173 <pre>
174 if (warnings::enabled($object))
175 { warnings::warn($object, $message) }</pre>
176 </dd>
177 </li>
178 </dl>
179 <p>See <a href="file://C|\msysgit\mingw\html/pod/perlmodlib.html#pragmatic_modules">Pragmatic Modules in the perlmodlib manpage</a> and <a href="file://C|\msysgit\mingw\html/pod/perllexwarn.html">the perllexwarn manpage</a>.</p>
180 <table border="0" width="100%" cellspacing="0" cellpadding="3">
181 <tr><td class="block" style="background-color: #cccccc" valign="middle">
182 <big><strong><span class="block">&nbsp;warnings - Perl pragma to control optional warnings</span></strong></big>
183 </td></tr>
184 </table>
186 </body>
188 </html>