Module::PrintUsed - Prints modules used by your script when your script ends
use Module::PrintUsed;
This module helps you to check which modules (and scripts) were used or required during the runtime of your script. It prints the list of modules to STDERR, including version numbers and paths.
use
require
Module::PrintUsed contains an END {} block that will be executed when your script exits (even if it died).
END {}
It is possible to print a list of modules used even without modifying your perl scripts or programs. To achieve this, set the PERL5OPT environment variable to "-MModule::PrintUsed".
Unix command-line example:
env PERL5OPT=-MModule::PrintUsed perl myscript.pl
Windows command-line example:
set PERL5OPT=-MModule::PrintUsed perl myscript.pl
Module::PrintUsed::ModulesList()
Returns a list of modules used in the format
@modules = ({name => 'Some::Module', version => '0.1', path => '/home/thisuser/lib/Some/Module.pm'}, ...);
Module::PrintUsed::FormattedModulesList()
Returns a scalar that contains a pretty-printed version of the modules list.
Please report any bugs sing the CPAN RT system. The development repository for this module is hosted on GitHub: http://github.com/crenz/Module-PrintUsed/.
Thanks to Slaven Rezić for pointing out that Module::PrintUsed can be used with the PERL5OPT environment variable, and for alerting me to warnings caused by autosplitted modules.
A more sophisticated way of finding module dependencies without having to execute the script is performed by Module::ScanDeps.
Christian Renz, <crenz @ web42.com>
Copyright 2004-2015 Christian Renz <crenz @ web42.com>. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Module::PrintUsed, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Module::PrintUsed
CPAN shell
perl -MCPAN -e shell install Module::PrintUsed
For more information on module installation, please visit the detailed CPAN module installation guide.