Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Which modules does use?

by myuserid7 (Scribe)
on Apr 14, 2005 at 10:10 UTC ( #447684=perlquestion: print w/replies, xml ) Need Help??

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

Hello! I remember a while back using a nice perl module that would show me which modules a given script uses (and the modules those modules use, etc). I can't remember whether I dreamt this, or whether it really happened. Can anyone help?

Replies are listed 'Best First'.
Re: Which modules does use?
by ghenry (Vicar) on Apr 14, 2005 at 10:21 UTC

    Doing a search on the site revealed finding all modules used from a script


    Walking the road to enlightenment... I found a penguin and a camel on the way.....
    Fancy a Just ask!!!
      Thanks. I tried a similar search, unfortunately not with the word "finding". Gah!
Re: Which modules does use?
by Taulmarill (Deacon) on Apr 14, 2005 at 10:14 UTC
    i don't know of a specific module, but the modules you use in a script are listet in %INC.
    try perl -MData::Dumper -e'print Dumper \%INC'
      Can I get this to run before the script exits? I'm trying to debug a script, and don't know where it's failing, which is why I need the module.

        Sure, add something like:

        use Data::Dumper; END { print Dumper \%INC }
        at the top of the program file.


        you can print out %INC at anny time you want to ;)
        modules that are importet by use are done in compile time, so they are in %INC right from the start. if you actualy use require, those modules should appear after you "required" them.
        The perl debugger is your friend (though not a very pretty one ;-)

        Check out perldebtut.(perldoc perldebtut)


Re: Which modules does use?
by davidrw (Prior) on Apr 14, 2005 at 13:32 UTC
    This may get you more than you want, but does provide a lot of information. You can play with the -select an -ignore settings of Devel::Cover ...
    mkdir /tmp/myscript_cover perl -MDevel::Cover=-db,/tmp/myscript_cover,-select,. /tmp/
    I ran this against: the following, and was able to see the used modules in the Devel::Cover output.
    use strict; use File::Path; mkpath '/tmp/asdasd'; use Image::Magick; my $IMG_BLANK = Image::Magick->new();

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://447684]
Approved by ghenry
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2023-09-24 19:57 GMT
Find Nodes?
    Voting Booth?

    No recent polls found