On Thu, Oct 16, 2008 at 00:06, howa <[EMAIL PROTECTED]> wrote: > > Hello, > > Conside I have the code: > > use LWP::UserAgent (); > use Apache::DBI (); > use DBI (); > ... > ... > > Some points later, I want to list all the used modules, is it > possible? > > E.g. Print out > > LWP::UserAgent > Apache::DBI > DBI > > > Thanks.
You can use the global hash %INC* to find all files loaded via require, use, or do. #!/usr/bin/perl use strict; use warnings; use Data::Dumper; print "files loaded:\n", map { "\t$_\n" } sort keys %INC; #make the files look like they would on a use print "modules loaded:\n", map { s#/#::#g; s/\.pm$//; "\t$_\n" } sort keys %INC; * http://perldoc.perl.org/perlvar.html#%INC -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/