<%init> #!/usr/bin/perl use CGI qw(:all); use strict; use warnings; no warnings 'closure'; use Data::Dumper; my @mods; #------------------------------------------------------------------------------- sub list_modules { my ($n, $msg, $i); eval "use File::Find;"; if ($@) { disp_html(qq|Sorry, File::Find is not installed on this server.|); } find(\&wanted, @INC); @mods = sort {lc($a) cmp lc($b)} @mods; my $prev = 'none'; @mods = grep($_ ne $prev && (($prev) = $_), @mods); $n = @mods; $msg = qq|

Found: $n Modules

\n|; $msg .= qq|
\n|; $msg .= " \n"; $msg .= qq| \n\n \n
\n|; $i = 0; foreach (@mods) { $i++; $msg .= qq| $_
\n|; if (($i == int(($n / 3) + 2 / 3)) or ($i == int((2 * $n / 3) + 2 / 3 ))) { $msg .= qq|
\n|; } } $msg .= "
\n
\n
\n"; &disp_html($msg); } #------------------------------------------------------------------------------- sub wanted { if ($File::Find::name =~ /\.pm$/) { open(F, $File::Find::name) || return; while() { if (/^ *package +(\S+);/) { push (@mods, $1); last; } } close(F); } } #------------------------------------------------------------------------------- sub disp_html { my $mods = shift; print qq| LIST MODULES

LIST PERL MODULES INSTALLED ON THIS SERVER


$mods
|; } #------------------------------------------------------------------------------- print header(); list_modules;