#!/usr/bin/env perl # test.pl v18.08.08 # (c)2002-2018 Cusimano.Com Corporation, all rights reserved use HTML::Entities; my $www = $ENV{'SERVER_PORT'} ne ''; sub enc { return $www ? encode_entities( $_[0] ) : $_[0] } eval 'use Compress::Zlib'; $hasCompress = $@ ? 0 : 1; eval 'use LWP'; $hasLWP = $@ ? 0 : 1; eval 'use LWP::Simple'; $hasLWPsimple = $@ ? 0 : 1; if ($hasLWPsimple) { eval 'use LWP::UserAgent'; my $ua = LWP::UserAgent->new(timeout => 30); $u = 'http://www.c3scripts.com/test/test.txt'; $resp = $ua->request(HTTP::Request->new('GET', $u)); $okLWP = $resp->content =~ /test\.pl/i; } eval 'use CGI::Carp qw(fatalsToBrowser)'; $hasCGI = $@ ? 0 : 1; $w = 24; $f = '%' . $w . "s : %s\n"; $f2 = ' ' x $w . ' ' . &enc('&') . " %s\n"; print "Content-type: text/html\n\n
" if ($www);
printf $f, 'test.pl', 'v18.08.08';
printf $f, 'Perl', "v$]";
printf $f, 'CGI::Carp', ($hasCGI? '' : 'not ') . 'installed';
printf $f, 'Compress::Zlib', ($hasCompress? '' : 'not ') . 'installed';
printf $f, 'LWP', ($hasLWP? "v$LWP::VERSION " : 'not ') . 'installed';
printf $f, 'LWP::Simple', ($hasLWPsimple? '' : 'not ') . 'installed';
printf $f, 'LWP::Simple', 'rx ' . ($okLWP? '' : 'not ') . 'ok' if ($hasLWPsimple);
printf $f, '@INC', &enc($INC[0]); foreach $x (1..$#INC) { printf $f2, &enc($INC[$x]) }
foreach $x (sort keys %ENV) { printf $f, &enc($x), &enc($ENV{$x}) }
print "
\n" if ($www); 1;