how to list all loaded modules of a perl program

F

Fei Liu

Hi group, is it possible to list all loaded modules of a perl program?
For example, the perl application could have a very complicated
hierarchy of module structure where each module load different modules
on their own:

i.e
package main
use A;
use C;

package A
use B;

package C
use D;

package B
use BA;
use BB;

package D;
use DA;
use DB;
use DC;

package DA
use DAA;
use DAB;

etc, etc.

Now is it possible within the main program to list all the preloaded
modules via use statement? It's possible to do this by using a parser
to recursively parse through modules with a predefined level, but
idealy a in program complete list could be better.

Please let me know if there is an existing solution for this problem,
thanks!

Fei
 
U

usenet

Hi group, is it possible to list all loaded modules of a perl program?

At any time in a program you may print the contents of %INC, which
will tell you what modules are loaded.

If you want to know every module ever loaded, use an end block, such
as:

END {
print Dumper \%INC;
}


If you wish to know how much time your program spent inside of each
method of each module:

perl -d:profile whatever.pl
 

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,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top