How to find Modules used by a Given Module

I

++imanshu

Is there a module/script that can give the names of all modules a
module/script uses directly or indirectly.

e.g.

% perl magic.pl < Input.pm

GetOpt::Long
MyModule
EveryModule

where Input.pm uses GetOpt::Long and MyModule. MyModule in turn uses
EveryModule. Note that one is a standard module and the other two are
custom modules.

Thanks,
HG
 
P

Peter Makholm

++imanshu said:
Is there a module/script that can give the names of all modules a
module/script uses directly or indirectly.

The following should give you the list of modules loaded right after
loading the module some::Module:

$ perl -MSome::Module -le 'print for keys %INC'

(Some post processing required)

But this only findes modules which is loaded at the same time as
Some::Module is loaded. Some modules will dynamically load other
modules at runtime. For example trying to print the modules loaded by
DBI wouldn't show any driver modules, which is very much needed by any
normal DBI using script.

//Makholm
 
I

++imanshu

The following should give you the list of modules loaded right after
loading the module some::Module:

  $ perl -MSome::Module -le 'print for keys %INC'

This is wonderful. Thanks
(Some post processing required)

But this only findes modules which is loaded at the same time as
Some::Module is loaded. Some modules will dynamically load other
modules at runtime. For example trying to print the modules loaded by
DBI wouldn't show any driver modules, which is very much needed by any
normal DBI using script.

Yes I don't care about those for now.

Many Thanks
HG
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top