#!/usr/bin/perl
# It creates a HTML table displaying all Perl Modules Installed
# Run on Windows and Unix.
use strict;
use File::Find;
my $count = 0;
open( OUTFILE, ">modules.html" );
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 OUTFILE "Content-type: text/html\n\n";
print OUTFILE "<HTML><HEAD><TITLE>Installed Perl Modules</TITLE></HEAD><BODY bgcolor='#c0c0c0'>";
print OUTFILE "<h3 align='center'>Perl Modules Installed</h3>";
# list table heading
print OUTFILE "<table border=1 bgcolor='#999999' align='center'>";
print OUTFILE "<tr><th>Perl Module Number</th><th>Perl Module Name</th></tr>\n";
foreach (@mod) { s,^/(.*)\.pm$,$1,; s,/,::,g;
print OUTFILE "<tr align='center'>";
print OUTFILE "<td>$count</td>";
print OUTFILE "<td>$_</td>";
print OUTFILE "</tr>\n";
$count++;
}
print OUTFILE "</table>";
print OUTFILE "Total : ($#mod modules!)\n\n";
sub get { /^.*\.pm$/ && /$ARGV[0]/i && push @mod, $File::Find::name; }