Install Perl 5.8.8
[msysgit.git] / mingw / html / lib / B / Lint.html
blob0b60e7e4f348a41632416754e994270752a66095
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>B::Lint - Perl lint</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;B::Lint - Perl lint</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 <li><a href="#options_and_lint_checks">OPTIONS AND LINT CHECKS</a></li>
26 <li><a href="#non_lintcheck_options">NON LINT-CHECK OPTIONS</a></li>
27 <li><a href="#bugs">BUGS</a></li>
28 <li><a href="#author">AUTHOR</a></li>
29 </ul>
30 <!-- INDEX END -->
32 <hr />
33 <p>
34 </p>
35 <h1><a name="name">NAME</a></h1>
36 <p>B::Lint - Perl lint</p>
37 <p>
38 </p>
39 <hr />
40 <h1><a name="synopsis">SYNOPSIS</a></h1>
41 <p>perl -MO=Lint[,OPTIONS] foo.pl</p>
42 <p>
43 </p>
44 <hr />
45 <h1><a name="description">DESCRIPTION</a></h1>
46 <p>The B::Lint module is equivalent to an extended version of the <strong>-w</strong>
47 option of <strong>perl</strong>. It is named after the program <em>lint</em> which carries
48 out a similar process for C programs.</p>
49 <p>
50 </p>
51 <hr />
52 <h1><a name="options_and_lint_checks">OPTIONS AND LINT CHECKS</a></h1>
53 <p>Option words are separated by commas (not whitespace) and follow the
54 usual conventions of compiler backend options. Following any options
55 (indicated by a leading <strong>-</strong>) come lint check arguments. Each such
56 argument (apart from the special <strong>all</strong> and <strong>none</strong> options) is a
57 word representing one possible lint check (turning on that check) or
58 is <strong>no-foo</strong> (turning off that check). Before processing the check
59 arguments, a standard list of checks is turned on. Later options
60 override earlier ones. Available options are:</p>
61 <dl>
62 <dt><strong><a name="item_context"><strong>context</strong></a></strong>
64 <dd>
65 <p>Produces a warning whenever an array is used in an implicit scalar
66 context. For example, both of the lines</p>
67 </dd>
68 <dd>
69 <pre>
70 $foo = length(@bar);
71 $foo = @bar;</pre>
72 </dd>
73 <dd>
74 <p>will elicit a warning. Using an explicit <strong>scalar()</strong> silences the
75 warning. For example,</p>
76 </dd>
77 <dd>
78 <pre>
79 $foo = scalar(@bar);</pre>
80 </dd>
81 </li>
82 <dt><strong><a name="item_implicit_2dread_and_implicit_2dwrite"><strong>implicit-read</strong> and <strong>implicit-write</strong></a></strong>
84 <dd>
85 <p>These options produce a warning whenever an operation implicitly
86 reads or (respectively) writes to one of Perl's special variables.
87 For example, <strong>implicit-read</strong> will warn about these:</p>
88 </dd>
89 <dd>
90 <pre>
91 /foo/;</pre>
92 </dd>
93 <dd>
94 <p>and <strong>implicit-write</strong> will warn about these:</p>
95 </dd>
96 <dd>
97 <pre>
98 s/foo/bar/;</pre>
99 </dd>
100 <dd>
101 <p>Both <strong>implicit-read</strong> and <strong>implicit-write</strong> warn about this:</p>
102 </dd>
103 <dd>
104 <pre>
105 for (@a) { ... }</pre>
106 </dd>
107 </li>
108 <dt><strong><a name="item_bare_2dsubs"><strong>bare-subs</strong></a></strong>
110 <dd>
111 <p>This option warns whenever a bareword is implicitly quoted, but is also
112 the name of a subroutine in the current package. Typical mistakes that it will
113 trap are:</p>
114 </dd>
115 <dd>
116 <pre>
117 use constant foo =&gt; 'bar';
118 @a = ( foo =&gt; 1 );
119 $b{foo} = 2;</pre>
120 </dd>
121 <dd>
122 <p>Neither of these will do what a naive user would expect.</p>
123 </dd>
124 </li>
125 <dt><strong><a name="item_dollar_2dunderscore"><strong>dollar-underscore</strong></a></strong>
127 <dd>
128 <p>This option warns whenever <a href="file://C|\msysgit\mingw\html/pod/perlvar.html#item___"><code>$_</code></a> is used either explicitly anywhere or
129 as the implicit argument of a <strong>print</strong> statement.</p>
130 </dd>
131 </li>
132 <dt><strong><a name="item_private_2dnames"><strong>private-names</strong></a></strong>
134 <dd>
135 <p>This option warns on each use of any variable, subroutine or
136 method name that lives in a non-current package but begins with
137 an underscore (``_''). Warnings aren't issued for the special case
138 of the single character name ``_'' by itself (e.g. <a href="file://C|\msysgit\mingw\html/pod/perlvar.html#item___"><code>$_</code></a> and <a href="file://C|\msysgit\mingw\html/pod/perlvar.html#item___"><code>@_</code></a>).</p>
139 </dd>
140 </li>
141 <dt><strong><a name="item_undefined_2dsubs"><strong>undefined-subs</strong></a></strong>
143 <dd>
144 <p>This option warns whenever an undefined subroutine is invoked.
145 This option will only catch explicitly invoked subroutines such
146 as <code>foo()</code> and not indirect invocations such as <code>&amp;$subref()</code>
147 or <code>$obj-&gt;meth()</code>. Note that some programs or modules delay
148 definition of subs until runtime by means of the AUTOLOAD
149 mechanism.</p>
150 </dd>
151 </li>
152 <dt><strong><a name="item_regexp_2dvariables"><strong>regexp-variables</strong></a></strong>
154 <dd>
155 <p>This option warns whenever one of the regexp variables <a href="file://C|\msysgit\mingw\html/pod/perlvar.html#item___"><code>$`</code></a>, <a href="file://C|\msysgit\mingw\html/pod/perlvar.html#item___"><code>$&amp;</code></a> or <a href="file://C|\msysgit\mingw\html/pod/perlvar.html#item___"><code>$'</code></a>
156 is used. Any occurrence of any of these variables in your
157 program can slow your whole program down. See <a href="file://C|\msysgit\mingw\html/pod/perlre.html">the perlre manpage</a> for
158 details.</p>
159 </dd>
160 </li>
161 <dt><strong><a name="item_all"><strong>all</strong></a></strong>
163 <dd>
164 <p>Turn all warnings on.</p>
165 </dd>
166 </li>
167 <dt><strong><a name="item_none"><strong>none</strong></a></strong>
169 <dd>
170 <p>Turn all warnings off.</p>
171 </dd>
172 </li>
173 </dl>
175 </p>
176 <hr />
177 <h1><a name="non_lintcheck_options">NON LINT-CHECK OPTIONS</a></h1>
178 <dl>
179 <dt><strong><a name="item__2du_package"><strong>-u Package</strong></a></strong>
181 <dd>
182 <p>Normally, Lint only checks the main code of the program together
183 with all subs defined in package main. The <strong>-u</strong> option lets you
184 include other package names whose subs are then checked by Lint.</p>
185 </dd>
186 </li>
187 </dl>
189 </p>
190 <hr />
191 <h1><a name="bugs">BUGS</a></h1>
192 <p>This is only a very preliminary version.</p>
193 <p>This module doesn't work correctly on thread-enabled perls.</p>
195 </p>
196 <hr />
197 <h1><a name="author">AUTHOR</a></h1>
198 <p>Malcolm Beattie, <a href="mailto:mbeattie@sable.ox.ac.uk.">mbeattie@sable.ox.ac.uk.</a></p>
199 <table border="0" width="100%" cellspacing="0" cellpadding="3">
200 <tr><td class="block" style="background-color: #cccccc" valign="middle">
201 <big><strong><span class="block">&nbsp;B::Lint - Perl lint</span></strong></big>
202 </td></tr>
203 </table>
205 </body>
207 </html>