#!/usr/bin/perl use strict; use File::Find; my @foundmods; my %found; my (@mod1, @mod2); print "Content-type: text/html\n\n"; my $perl_version = sprintf("%vd", $^V); # human readable version of $] print qq~ Perl Configuration

Perl Configuration

Program Paths
Perl Version$perl_version
Perl Executable$^X
PERL compile version OS$^O
Location of Perl~; foreach my $location (split ' ', `whereis perl`) { print "$location
\n"; } print qq~
Location of Sendmail~; foreach my $location (split ' ', `whereis sendmail`) { print "$location
\n"; } print qq~
Directory locations searched for perl executables~; foreach my $location (@INC) { print "$location
\n"; } print qq~
~; foreach my $var (keys %ENV) { print qq~ ~; } print qq~
Environment Variables
$var$ENV{$var}
~; find({wanted=>\&wanted,follow=>1,follow_skip=>2},@INC); my $modcount = 0; foreach my $line (@foundmods){ my $match = lc $line; if ($found{$line}[0] > 0) { $found{$line} = [$found{$line}[0]+1, $match]; } else { $found{$line} = [1, $match]; $modcount++; } } @foundmods = sort count keys(%found); my $third = $modcount/3; my $count=0; print qq~
Installed Perl Modules
~; foreach my $mod (@foundmods){ chomp $mod; $count++; if ($count <= $third){ print qq~ ~; } else { push (@mod1,$mod) } } print qq~
$mod
~; $count = 0; foreach my $mod1 (@mod1){ chomp $mod1; $count++; if ($count <= $third){ print qq~ ~; } else { push (@mod2,$mod1) } } print qq~
$mod1
~; $count = 0; foreach my $mod2 (@mod2){ chomp $mod2; $count++; if ($count <= $third){ print qq~ ~; } } print qq~
$mod2
~; exit; sub count { return $found{$a}[1] cmp $found{$b}[1]; } sub wanted { if ($File::Find::name =~ /\.pm$/){ open(my $MODFILE, '<', $File::Find::name) || return; while (<$MODFILE>){ if (/^ *package +(\S+);/){ push (@foundmods, $1); last; } } } }