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">
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:" />
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"> B::Lint - Perl lint
</span></strong></big>
17 <p><a name=
"__index__"></a></p>
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>
35 <h1><a name=
"name">NAME
</a></h1>
36 <p>B::Lint - Perl lint
</p>
40 <h1><a name=
"synopsis">SYNOPSIS
</a></h1>
41 <p>perl -MO=Lint[,OPTIONS] foo.pl
</p>
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>
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>
62 <dt><strong><a name=
"item_context"><strong>context
</strong></a></strong>
65 <p>Produces a warning whenever an array is used in an implicit scalar
66 context. For example, both of the lines
</p>
74 <p>will elicit a warning. Using an explicit
<strong>scalar()
</strong> silences the
75 warning. For example,
</p>
79 $foo = scalar(@bar);
</pre>
82 <dt><strong><a name=
"item_implicit_2dread_and_implicit_2dwrite"><strong>implicit-read
</strong> and
<strong>implicit-write
</strong></a></strong>
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>
94 <p>and
<strong>implicit-write
</strong> will warn about these:
</p>
101 <p>Both
<strong>implicit-read
</strong> and
<strong>implicit-write
</strong> warn about this:
</p>
105 for (@a) { ... }
</pre>
108 <dt><strong><a name=
"item_bare_2dsubs"><strong>bare-subs
</strong></a></strong>
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
117 use constant foo =
> 'bar';
118 @a = ( foo =
> 1 );
122 <p>Neither of these will do what a naive user would expect.
</p>
125 <dt><strong><a name=
"item_dollar_2dunderscore"><strong>dollar-underscore
</strong></a></strong>
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>
132 <dt><strong><a name=
"item_private_2dnames"><strong>private-names
</strong></a></strong>
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>
141 <dt><strong><a name=
"item_undefined_2dsubs"><strong>undefined-subs
</strong></a></strong>
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>&$subref()
</code>
147 or
<code>$obj-
>meth()
</code>. Note that some programs or modules delay
148 definition of subs until runtime by means of the AUTOLOAD
152 <dt><strong><a name=
"item_regexp_2dvariables"><strong>regexp-variables
</strong></a></strong>
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>$
&</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
161 <dt><strong><a name=
"item_all"><strong>all
</strong></a></strong>
164 <p>Turn all warnings on.
</p>
167 <dt><strong><a name=
"item_none"><strong>none
</strong></a></strong>
170 <p>Turn all warnings off.
</p>
177 <h1><a name=
"non_lintcheck_options">NON LINT-CHECK OPTIONS
</a></h1>
179 <dt><strong><a name=
"item__2du_package"><strong>-u Package
</strong></a></strong>
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>
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>
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"> B::Lint - Perl lint
</span></strong></big>