Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: robustly list any Perl code's module dependencies

by simonflk (Pilgrim)
on Oct 06, 2002 at 14:00 UTC ( [id://203163]=note: print w/replies, xml ) Need Help??


in reply to robustly list any Perl code's module dependencies

This is a nice trick, but it won't work if the script or or any modules that are loaded do a use lib or unshift @INC

Something like this should work, as long as require is not overriden elsewhere:

package ShowDependencies; use strict; *CORE::GLOBAL::require = \&show_require; sub show_require (;$) { my $module = shift; print STDERR $module, $/; my $retval = eval "CORE::require( $module )"; die $@ if $@; return $retval; } 1;

There is also a module (Module::Dependency) on the CPAN that builds a list of dependencies.

update: added use strict

-- simonflk

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://203163]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2025-06-14 07:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.