1B::Lint(3pm) Perl Programmers Reference Guide B::Lint(3pm)
2
3
4
6 B::Lint - Perl lint
7
9 perl -MO=Lint[,OPTIONS] foo.pl
10
12 The B::Lint module is equivalent to an extended version of the -w
13 option of perl. It is named after the program lint which carries out a
14 similar process for C programs.
15
17 Option words are separated by commas (not whitespace) and follow the
18 usual conventions of compiler backend options. Following any options
19 (indicated by a leading -) come lint check arguments. Each such argu‐
20 ment (apart from the special all and none options) is a word represent‐
21 ing one possible lint check (turning on that check) or is no-foo (turn‐
22 ing off that check). Before processing the check arguments, a standard
23 list of checks is turned on. Later options override earlier ones.
24 Available options are:
25
26 context Produces a warning whenever an array is used in an implicit
27 scalar context. For example, both of the lines
28
29 $foo = length(@bar);
30 $foo = @bar;
31
32 will elicit a warning. Using an explicit scalar() silences the
33 warning. For example,
34
35 $foo = scalar(@bar);
36
37 implicit-read and implicit-write
38 These options produce a warning whenever an operation implic‐
39 itly reads or (respectively) writes to one of Perl's special
40 variables. For example, implicit-read will warn about these:
41
42 /foo/;
43
44 and implicit-write will warn about these:
45
46 s/foo/bar/;
47
48 Both implicit-read and implicit-write warn about this:
49
50 for (@a) { ... }
51
52 bare-subs
53 This option warns whenever a bareword is implicitly quoted, but
54 is also the name of a subroutine in the current package. Typi‐
55 cal mistakes that it will trap are:
56
57 use constant foo => 'bar';
58 @a = ( foo => 1 );
59 $b{foo} = 2;
60
61 Neither of these will do what a naive user would expect.
62
63 dollar-underscore
64 This option warns whenever $_ is used either explicitly any‐
65 where or as the implicit argument of a print statement.
66
67 private-names
68 This option warns on each use of any variable, subroutine or
69 method name that lives in a non-current package but begins with
70 an underscore ("_"). Warnings aren't issued for the special
71 case of the single character name "_" by itself (e.g. $_ and
72 @_).
73
74 undefined-subs
75 This option warns whenever an undefined subroutine is invoked.
76 This option will only catch explicitly invoked subroutines such
77 as "foo()" and not indirect invocations such as "&$subref()" or
78 "$obj->meth()". Note that some programs or modules delay defi‐
79 nition of subs until runtime by means of the AUTOLOAD mecha‐
80 nism.
81
82 regexp-variables
83 This option warns whenever one of the regexp variables $`, $&
84 or $' is used. Any occurrence of any of these variables in your
85 program can slow your whole program down. See perlre for
86 details.
87
88 all Turn all warnings on.
89
90 none Turn all warnings off.
91
93 -u Package
94 Normally, Lint only checks the main code of the program
95 together with all subs defined in package main. The -u option
96 lets you include other package names whose subs are then
97 checked by Lint.
98
100 This is only a very preliminary version.
101
102 This module doesn't work correctly on thread-enabled perls.
103
105 Malcolm Beattie, mbeattie@sable.ox.ac.uk.
106
107
108
109perl v5.8.8 2001-09-21 B::Lint(3pm)