Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > How to list all the nested modules

Reply
Thread Tools

How to list all the nested modules

 
 
James
Guest
Posts: n/a
 
      06-05-2007
How to list all the nested modules,
similar to dependency in C-compiler (gcc -M)?

For example,

use Net::SSH:erl:acket;
use Net::SSH:erl::Buffer;
use Net::SSH:erl::Config;
use Net::SSH:erl::Constants qw( rotocol :compat :hosts );
use Net::SSH:erl::Cipher;
use Net::SSH:erl::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

 
Reply With Quote
 
 
 
 
Paul Lalli
Guest
Posts: n/a
 
      06-05-2007
On Jun 5, 4:40 pm, James <(E-Mail Removed)> wrote:
> How to list all the nested modules,
> similar to dependency in C-compiler (gcc -M)?
>
> For example,
>
> use Net::SSH:erl:acket;
> use Net::SSH:erl::Buffer;
> use Net::SSH:erl::Config;
> use Net::SSH:erl::Constants qw( rotocol :compat :hosts );
> use Net::SSH:erl::Cipher;
> use Net::SSH:erl::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

 
Reply With Quote
 
 
 
 
usenet@DavidFilmer.com
Guest
Posts: n/a
 
      06-05-2007
On Jun 5, 1:40 pm, James <(E-Mail Removed)> 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 -drofile whatever.pl


--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
how to list all installed modules harryos Python 3 02-19-2009 10:21 AM
list versions of all installed modules John [H2O] Python 0 10-28-2008 09:46 AM
getting list of all available modules Benjamin Rutt Python 2 06-21-2005 11:51 AM



Advertisments