#!/usr/bin/perl -Tw # #NAME # ae.cgi - CGI sanity test # #SYNOPSIS # http://host.dom.ain:port/CGI/ae.cgi/path/info?some&args=values... # #DESCRIPTION # This is a CGI script that returns a web page showing all its args # and environment variables. # # It is really a prototype CGI script, useful as a starting point # for writing other scripts. It is also useful on its own, as a # quick way of learning what a particular browser is sending to a # server. # #OPTIONS # #FILES # #BUGS # #SEE ALSO # #AUTHOR John Chambers $| = 1; use strict; my($e, $n, @names, $query, $v, @vals); use CGI; use CGI::Carp 'fatalsToBrowser'; use diagnostics; print "Content-type: text/html\n\n"; print "Test CGI $0\n"; print "
Test CGI $0
\n"; print "This is what your browser sent to this web server.\n"; print "
\n"; print "Form elements:\n"; $query = new CGI; @names = $query->param(); print "
\n"; for $n (sort @names) { if (@vals = $query->param($n)) { for $v (@vals) {print "
$n
\"$v\"\n"} } elsif ($v = $query->param($n)) { print "
$n
\"$v\"\n"; } else { print "
$n
(NO VALUE)\n"; } } print "
\n"; print "
\n"; print "Environment variables:\n"; print "
\n"; for $e (sort keys %ENV) { $v = $ENV{$e}; print "
$e
$v\n"; } print "
\n"; print "
\n";