#!/usr/bin/perl -w
# core idea from [diotalevi] on Oct 7 2004, id://397469
use Data::Dumper;
my $msg = "File Change Date 05-06-05 5Mod.pl\n";
my $title = "Simpler Module Inventory Script 05";
my $in; my @in; my %in;
my @list = qw(
CGI
CGI::Application
Data::Dumper
HTML::Template
);
my @extList = @ARGV;
&ReadParse;
##### Print header #####################################################
######print "\n\n";
print "Content-type: text/html\n\n";
print "
$title\n";
print "\n";
print "\n";
print "Running $0 in Perl $]
\n
";
print "\$in = $in\n
";
print "\@in = @in\n
";
#print "\@in2 = $in2[1],$in2[2]\n
";
print "\%in = %in\n
";
print "\n";
print "| Scalar \$in | \n";
print "\n";
print "Dumper(\$in)";
print " \n";
print " |
\n";
print "| Array \@in | \n";
print "\n";
print Dumper(\@in);
print " \n";
print " |
\n";
print "| Hash \%in | \n";
print "\n";
print Dumper(\%in);
print " \n";
print " |
";
print "Argv = @extList\n
";
print "\n";
print "\n";
for ( @in) {
print eval "require $_"
? "| $_ ok: | \n"
: "| $_ failed: | \n"
}
print " |
\n";
print "
\n";
print @list;
##### Print footer #####################################################
print "
\n\n";
print "webmaster\@cantrall.net
\n";
### created Oct 07 2004 ###
print "$msg\n";
print "\n\n\n";
exit (0);
########################################################################
# Perl Routines to Manipulate CGI input
# S.E.Brenner@bioc.cam.ac.uk
# $Header: /people/seb1005/http/cgi-bin/RCS/cgi-lib.pl,v 1.2 1994/01/10 15:05:40 seb1005 Exp $
#
# Copyright 1993 Steven E. Brenner
# Unpublished work.
# Permission granted to use and modify this library so long as the
# copyright above is maintained, modifications are documented, and
# credit is given for any use of the library.
# ReadParse
# Reads in GET or POST data, converts it to unescaped text, and puts
# one key=value in each member of the list "@in"
# Also creates key/value pairs in %in, using '\0' to separate multiple
# selections
# If a variable-glob parameter (e.g., *cgi_input) is passed to ReadParse,
# information is stored there, rather than in $in, @in, and %in.
sub ReadParse {
if (@_) {
local (*in) = @_;
}
local ($i, $loc, $key, $val);
# Read in text
if ($ENV{'REQUEST_METHOD'} eq "GET") {
$in = $ENV{'QUERY_STRING'};
} elsif ($ENV{'REQUEST_METHOD'} eq "POST") {
for ($i = 0; $i < $ENV{'CONTENT_LENGTH'}; $i++) {
$in .= getc;
}
}
@in = split(/&/,$in);
#@in =~ s/\\0/0A/g;
#my @in2 = @in;
#my $junk = shift @in2;
foreach $i (0 .. $#in) {
# Convert plus's to spaces
$in[$i] =~ s/\+/ /g;
# Convert %XX from hex numbers to alphanumeric
$in[$i] =~ s/%(..)/pack("c",hex($1))/ge;
# Split into key and value.
$loc = index($in[$i],"=");
$key = substr($in[$i],0,$loc);
$val = substr($in[$i],$loc+1);
$in{$key} .= '\0' if (defined($in{$key})); # \0 is the multiple separator
$in{$key} .= $val;
}
return 1; # just for fun
}