How to list all the nested modules

J

James

How to list all the nested modules,
similar to dependency in C-compiler (gcc -M)?

For example,

use Net::SSH::perl::packet;
use Net::SSH::perl::Buffer;
use Net::SSH::perl::Config;
use Net::SSH::perl::Constants qw( :protocol :compat :hosts );
use Net::SSH::perl::Cipher;
use Net::SSH::perl::Util qw( :hosts _read_yes_or_no );
use IO::Socket;
use IO::Select;
use Socket;
use Fcntl;
use Symbol;
use Errno qw(EAGAIN EWOULDBLOCK);
use Carp qw(croak);
use Sys::Hostname;


TIA
James
 
P

Paul Lalli

How to list all the nested modules,
similar to dependency in C-compiler (gcc -M)?

For example,

use Net::SSH::perl::packet;
use Net::SSH::perl::Buffer;
use Net::SSH::perl::Config;
use Net::SSH::perl::Constants qw( :protocol :compat :hosts );
use Net::SSH::perl::Cipher;
use Net::SSH::perl::Util qw( :hosts _read_yes_or_no );
use IO::Socket;
use IO::Select;
use Socket;
use Fcntl;
use Symbol;
use Errno qw(EAGAIN EWOULDBLOCK);
use Carp qw(croak);
use Sys::Hostname;

Not quite sure what you're going for, but maybe you want the keys of
the %INC hash?

$ perl -MLWP::Simple -le'
for (sort keys %INC) {
s!/!::!g;
s!\.pm$!!;
print;
}
'
Carp
Exporter
Exporter::Heavy
HTTP::Status
LWP::Simple
strict
vars
warnings
warnings::register

Paul Lalli
 
U

usenet

How to list all the nested modules,

At any time in a program you may print the contents of %INC, which
will tell you what modules are loaded (you may prefer to print it
using Dumper).

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top