Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Locate modules called by script

by bwelch (Curate)
on May 10, 2005 at 13:44 UTC ( #455566=perlquestion: print w/ replies, xml ) Need Help??
bwelch has asked for the wisdom of the Perl Monks concerning the following question:

Is there a good way to find the locations and names of modules called by a script? The script is being moved from Solaris to Linux and calls many bioinformatics modules. I need to figure out where all these modules reside to copy to the Linux system.

Comment on Locate modules called by script
Re: Locate modules called by script
by dragonchild (Archbishop) on May 10, 2005 at 13:48 UTC
    %INC is your friend. Inspect it and see what it stores.

    Better yet is to just use the CPAN module and install them on the new machine.


    • In general, if you think something isn't in Perl, try it out, because it usually is. :-)
    • "What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?"
Re: Locate modules called by script
by DrWhy (Chaplain) on May 10, 2005 at 14:20 UTC
    You might find more interesting ideas by typing 'all modules' in the search box at the top of this page. ...and then hitting the return key ;)

    --DrWhy

    "If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."

Re: Locate modules called by script
by thundergnat (Deacon) on May 10, 2005 at 14:23 UTC
    The Module::ScanDeps module will recursively find all modules used by your scripts. It will also find all core modules, so you need to sort out what you do and don't need.
    use strict; use warnings; use Module::ScanDeps; # insert your script(s) name(s) here my @scripts = qw/ myscript.pl /; my $hash_ref = scan_deps( files => \@scripts, recurse => 1, ); print $$hash_ref{$_}->{'key'}."\n" for sort keys %$hash_ref;
    Ideally though, you should just use CPAN to install the necessary modules.
Re: Locate modules called by script
by jhourcle (Prior) on May 10, 2005 at 15:11 UTC
    I need to figure out where all these modules reside to copy to the Linux system

    I use the following to get info about where a module is, what other modules it ends up loading, and its version:

    #!/bin/sh perl "-M$1" -e 'print map { sprintf( "%20s : %s\n", $_, $INC{$_} ) } s +ort keys %INC; print "\n'$1' version : $'$1'::VERSION\n\n"'

    That being said, it's very important to look at where it is, before you decide to up and move it to a different architecture or OS. Take the following:

    Any of the components with the architecture in their name (in this example, 'darwin-thread-multi-2level', have compiled components, and cannot just be picked up and moved to the new server.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2014-08-30 22:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (294 votes), past polls