Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Which modules does somescript.pl use?

by myuserid7 (Scribe)
on Apr 14, 2005 at 10:10 UTC ( [id://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 somescript.pl 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

    HTH.

    Walking the road to enlightenment... I found a penguin and a camel on the way.....
    Fancy a yourname@perl.me.uk? Just ask!!!
      Thanks. I tried a similar search, unfortunately not with the word "finding". Gah!
Re: Which modules does somescript.pl 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.

        /J\

        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)

        -Jim

      Thanks!
Re: Which modules does somescript.pl 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/myscript.pl
    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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-25 10:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found