This is the code that I use on our servers -
#!/usr/bin/perl
use strict;
use File::Find;
my $count = 0;
my (@mod, %done, $dir);
find(\&get, grep { -r and -d } @INC);
@mod = grep(!$done{$_}++, @mod);
foreach $dir (sort { length $b <=> length $a } @INC) {
foreach (@mod) { next if s,^\Q$dir,,; }
}
print "Content-type: text/html\n\n";
print "<HTML><HEAD><TITLE>Installed Perl Modules</TITLE></HEAD><BODY bgcolor='#c0c0c0'>";
print "<h3 align='center'>Perl Modules Installed Thor</h3>";
# list table heading
print "<table border=1 bgcolor='#999999' align='center'>";
print "<tr><th>Perl Module Number</th><th>Perl Module Name</th></tr>\n";
foreach (@mod) { s,^/(.*)\.pm$,$1,; s,/,::,g;
print "<tr align='center'>";
print "<td>$count</td>";
print "<td>$_</td>";
print "</tr>\n";
$count++;
}
print "</table>";
print "Total : ($#mod modules!)\n\n";
sub get { /^.*\.pm$/ && /$ARGV[0]/i && push @mod, $File::Find::name; }
Hope this helps !
Rab