Devel::Modlist - Perl extension to collect module use information
perl -d:Modlist script.pl
The Devel::Modlist utility is provided as a means by which to get a quick run-down on which libraries and modules are being utilized by a given script.
Just as compiler systems like gcc provide dependancy information via
switches such as -M
, Devel::Modlist is intended to assist script authors
in preparing dependancy information for potential users of their scripts.
Usage of Devel::Modlist is simple. The primary method of invocation is to
use the -d
option of Perl:
perl -d:Modlist script.pl
Alternately, one could use the -M
option:
perl -MDevel::Modlist script.pl
In the case of this module, the two are identical save for the amount of typing (and option passing, see below). It is not recommended that this module be loaded directly by a script via the use keyword, as that would cause the dependancy reporting after every invocation until it was removed from the code.
The following options may be specified to the package. These are specified either by:
perl -MDevel::Modlist=option1[,option2,...]
or
perl -d:Modlist=option1[,option2,...]
Options may also be given in an environment variable, which gets read at any invocation in which there are no options explicitly provided. If any options are given in the invocation, then the environment variable is ignored. Two different names are recognized:
Devel::Modlist Devel__Modlist
The latter is to accomodate shells that do not like the presence of ::
in
an environment variable name.
The options:
install
command to ensure that all needed
modules are in fact present.
$VERSION
in the package namespace, Devel::Modlist
finds this and includes it in the report by default. Use this option to
override that default.
Perl versions up to 5.6.0 cannot accept options to the -d:
flag as
with the -M
flag. Thus, to pass options one must use:
perl -MDevel::Modlist=option1[,option2,...]
Unfortunately, this inhibits the stop option detailed earlier. To use this option, an invocation of:
perl -d:Modlist -MDevel::Modlist=option1[,option2,...]
does the trick, as the first invocation puts the interpreter in debugging mode (necessary for stop to work) while the second causes the options to be parsed and recorded by Devel::Modlist.
Versions of Perl from 5.6.1 onwards allow options to be included with the
-d:Modlist
flag.
Randy J. Ray <rjray@blackperl.com>, using idea and prototype code provided by Tim Bunce <Tim.Bunce@ig.co.uk>
perl(1).