Devel::ModlistVersion 0.5 (second beta)
The Devel::Modlist package is a tool for deriving dependancy lists for Perl scripts or modules. The module is entirely Perl code, and thus does not require any compilation or linking for use.
When developing larger applications, one may often find that they have made use of modules (perhaps from CPAN) that are not guaranteed to be present on the target machine(s). One can easily use tools such as grep to identify lines that load such modules, but there are circumstances where that might not be sufficient. This package uses the internal tracking that Perl itself uses to take note of which modules have been loaded by the script or library file. It also features a variety of options to tune the resulting output to the user's taste, in hopes of being useful in larger systems.
The package is intended to be used similar to the debugger, the DProf profiler, or packages such as Devel::Coverage:
perl -d:Modlist your_script
This usage runs the script your_script, then prints the module usage data at the end of the run.
Several options are supported, including stop which tells the interpreter to stop the script immediately after compilation, before execution begins. Another option is cpan which uses the data that the CPAN module stores on your system in an effort to reduce the number of modules listed by comparing the list to the package data and only printing one module from a given distribution. An example will clarify this: Assume you have a script that includes the following segment:
For those three lines, only one line will be displayed when the cpan option is specified. Currently, it is the one of the three that occurs first alphabetically (this is arbitrary, and may change in the future). Thus, the dependancies could, for example, be used in conjunction with the CPAN module to have a generic install utility that determines which modules are needed in order for a script to run. (Of course, this would be on the part of the author to do as a step in the release process, since any missing scripts would prevent Devel::Modlist from getting past the compilation stage.)
The full set and syntax of options is covered in the manual page, which is linked below.
This package is available via the Comprehensive Perl Archive Network, or CPAN, indexed by my CPAN user-id, RJRAY. You can go directly to the package via this link:
This will always refer to the latest version CPAN has available.
In general, any system that can run Perl version 5.004 and newer should be able to install and use this module without difficulty, as it does not make use of any XS or C code for linkage.