Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Determining module dependencies

by echo (Pilgrim)
on Oct 12, 2001 at 14:29 UTC ( [id://118441]=perlquestion: print w/replies, xml ) Need Help??

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

I'm soon to install an application on a box on which has no Internet access. Therefore my plan is to bring along a CD with tarballs for all the modules my application requires. I'd like to be make sure I have all the dependencies covered though, is there a way to determine them in advance?

Replies are listed 'Best First'.
Re: Determining module dependencies
by Fletch (Bishop) on Oct 12, 2001 at 17:29 UTC
    END { print "$_ => $INC{$_}" for sort keys %INC }

    Or getting slightly fancy (but not foolproof)

    package DumpPkgs; use Filter::Util::Call; sub import { my( $type ) = @_; filter_add( bless { } ); } sub filter { my $self = shift; my $status; if( ($status = filter_read()) > 0 ) { print "Used $1\n" while /use\s+(\S+)/g } $status; } 1;

    You also could use the CPAN.pm autobundle command to generate a bundle of what's currently installed on the machine.

Re: Determining module dependencies
by MZSanford (Curate) on Oct 12, 2001 at 14:37 UTC
    You could run your code under the debugger and use the V command to examine what is being loaded ... or, you could add some code (maybe in an END block) to print out the contents of %INC (i think it holds that info)

    Last thought would be to use perl -Dp and some grepping.
    The requirements change because they don't know what they want, or how much they own you.
Re: Determining module dependencies
by andreychek (Parson) on Oct 13, 2001 at 05:42 UTC
    This isn't anywhere near as slick as fletch's solution.. however, I know you're a mod_perl guy.. so if you have your application running under mod_perl, you could always make use of mod_perl's status page, which lists all the loaded modules.

    Althought I know you know this, for the benefit of everyone else, you can put this code into your httpd.conf to give yourself access to a mod_perl status report:
    <Location /perl-status> SetHandler perl-script PerlHandler Apache::Status </Location>
    Then you just fire up your browser, and wander over to http://www.mydomain.com/perl-status.

    So if project X that you're working on now is the only Perl app loaded under mod_perl, it'd be pretty simple to figure out which modules it's using.

    TMTOWTDI ;-)

    -Eric

      Get Devel::Modlist and then run
      perl -d:Modlist=stop,path script.pl
      which should give you all modules along with their path for script.pl.
      The advantage is that you don't have to know all the modules installed.

      artist

Log In?
Username:
Password:

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

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

    No recent polls found