|
|
 |
 |
 |
 |
Perl Programming Language
|
 |
 |
 |
 |
 |
 |
 |
 |
How to list all the nested modules
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
On Jun 5, 4:40 pm, James <hslee@yahoo.com> wrote:
> 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
On Jun 5, 1:40 pm, James <hslee@yahoo.com> wrote: > 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 -- The best way to get a good answer is to ask a good question. David Filmer (http://DavidFilmer.com)
|
 |
 |
 |
 |
|