B::Lint - Perl lint |
B::Lint - Perl lint
perl -MO=Lint[,OPTIONS] foo.pl
The B::Lint module is equivalent to an extended version of the -w option of perl. It is named after the program lint which carries out a similar process for C programs.
Option words are separated by commas (not whitespace) and follow the usual conventions of compiler backend options. Following any options (indicated by a leading -) come lint check arguments. Each such argument (apart from the special all and none options) is a word representing one possible lint check (turning on that check) or is no-foo (turning off that check). Before processing the check arguments, a standard list of checks is turned on. Later options override earlier ones. Available options are:
$foo = length(@bar); $foo = @bar; will elicit a warning. Using an explicit B<scalar()> silences the warning. For example,
$foo = scalar(@bar);
/foo/;
and implicit-write will warn about these:
s/foo/bar/;
Both implicit-read and implicit-write warn about this:
for (@a) { ... }
use constant foo => 'bar'; @a = ( foo => 1 ); $b{foo} = 2;
Neither of these will do what a naive user would expect.
foo()
and not indirect invocations such as &$subref()
or $obj->meth()
. Note that some programs or modules delay
definition of subs until runtime by means of the AUTOLOAD
mechanism.
This is only a very preliminary version.
This module doesn't work correctly on thread-enabled perls.
Malcolm Beattie, mbeattie@sable.ox.ac.uk.
B::Lint - Perl lint |