The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Module::PrintUsed - Prints modules used by your script when your script ends

SYNOPSIS

  use Module::PrintUsed;

DESCRIPTION

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.

Module::PrintUsed contains an END {} block that will be executed when your script exits (even if it died).

USAGE VIA PERL5OPT

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

FUNCTIONS

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.

DEVELOPMENT NOTES

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

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.

SEE ALSO

A more sophisticated way of finding module dependencies without having to execute the script is performed by Module::ScanDeps.

AUTHOR

Christian Renz, <crenz @ web42.com>

COPYRIGHT AND LICENSE

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.