Code Development Tools
The O module has many interesting
Modi Operandi beyond feeding the exasperatingly experimental code
generators. By providing relatively painless access to the Perl
compiler's output, this module makes it easy to build other tools that
need to know everything about a Perl program.
The B::Lint module is named after
lint (1), the C program verifier. It
inspects programs for questionable constructs that often trip up
beginners but don't normally trigger warnings. Call the module
directly:
% perl -MO=Lint,all myprogOnly a few checks are currently defined, such as using an array
in an implicit scalar context, relying on default variables, and
accessing another package's (nominally private) identifiers that start
with _. See B::Lint (3)
for details.
The B::Xref module generates
cross-reference listings of the declaration and use of all variables
(both global and lexically scoped), subroutines, and formats in a
program, broken down by file and subroutine. Call the module this
way:
% perl -MO=Xref myprog > myprof.pxrefFor instance, here's a partial report:
Subroutine parse_argv
Package (lexical)
$on i113, 114
$opt i113, 114
%getopt_cfg i107, 113
@cfg_args i112, 114, 116, 116
Package Getopt::Long
$ignorecase 101
&GetOptions &124
Package main
$Options 123, 124, 141, 150, 165, 169
%$Options 141, 150, 165, 169
&check_read &167
@ARGV 121, 157, 157, 162, 166, 166This shows that the parse_argv subroutine had four lexical variables of its own; it also accessed global identifiers ...