Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Tips and Tricks _ Listing Perl Modules Installed

Posted by: Corey Dec 19 2003, 12:50 AM

Thanks to hughesjr for this tip:


Add this code to a file (I named it list_mods.pl)

QUOTE
#!/usr/bin/perl -w

use strict;
use CGI qw/:standard/;
use File::Find;

print header,
start_html,
h1("Perl Environment: $ENV{SERVER_NAME}"),
p("Perl Version: $]"),
p("CGI.pm Version: $CGI::VERSION"),
p("Library Path (\@INC):"),
ul(li([@INC])),
p('Modules:');

foreach my $dir (@INC) {
my @mods;
find(sub { push @mods, $File::Find::name if /\.pm$/ }, $dir);
print ul(li("$dir"), ul(li([sort @mods])));
}



Then run it like this:

perl list_mods.pl > list_mods.html

Open list_mods.html with your web browser...

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)