http://qs321.pair.com?node_id=482734

beth has asked for the wisdom of the Perl Monks concerning the following question:

When, in the course of human events, it becomes necessary to deploy our codebase (several svn checkouts containing perl modules, mod_perl scripts, command-line perl scripts) on a new machine, we usually forget to install some important required module.

How can we obtain a list of perl modules used/required by our codebase? Module::Info says it can get this information, but only for modules and not scripts. perl -c will die only on the *first* used module that is not available (obviously, we are interested in *all* such modules).

What other options do we have? I've been eagerly poking through the Test:: namespace, but have not yet found anything that does what we need.

Replies are listed 'Best First'.
Re: What modules does my code require?
by davidrw (Prior) on Aug 10, 2005 at 19:49 UTC
Re: What modules does my code require?
by xdg (Monsignor) on Aug 10, 2005 at 19:58 UTC

    Module::Info explicitly says you can hand it a script, not just a ".pm" file. Various other options: Module::ExtractUse, Module::ScanDeps, and Module::PrintUsed. Since it's your own, trusted code, you might like to try the last one.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.