#!/usr/bin/false #!/usr/bin/perl -T

# Remove '#!/usr/bin/false ' from the above in order to enable
# this script. It will not work as installed. Do not enable on
# a production server; we make no claims that this is a secure
# script.

##
# Show CGI Process Environment
# Wilfredo Sanchez | wsanchez@apple.com
# Apple Computer, Inc.
# Wed Oct 15 13:55:32 PDT 1997
##
# This perl program shows you how to access the process environment
#  for CGI programs on your web server.
# It is also a useful debuggin tool, as it shows you all of the
#  available environment variables.
##

# CGI programs must print their own HTTP response headers
print "Content-type: text/html\n";
print "\n";

# Declare the SGML application as HTML 3.2
print "<!doctype html public \"-//W3C/DTD HTML 3.2/EN\">\n";

# Begin HTML
print "<html>\n";

# A minimal document must include a header region with a title
print "<head>\n";
print "<link rev=\"made\" href=\"wsanchez\@apple.com\">"; # Author
print "<title>CGI Test</title>\n";
print "</head>\n";
print "\n";

# Start document body
print "<body>\n";
print "\n";

# Put values in a table to readability
print "<table border>\n";
print "\n";

# Caption the able
print " <caption>CGI Environment</caption>\n";
print "\n";

# Include table headers
print " <tr>\n";
print "  <th align=\"right\">\n";
print "   Variable\n";
print "  </th>\n";
print "  <th>\n";
print "   Value\n";
print "  </th>\n";
print " </tr>\n";

# Print each key/value pair as two column in a row
foreach $key (keys %ENV)
 {
  print "\n";
  print " <tr>\n";
  print "  <td align=\"right\">\n";
  print "   $key\n";
  print "  </td>\n";
  print "  <td>\n";
  print "   $ENV{$key}\n";
  print "  </td>\n";
  print " </tr>\n";
 }
print "\n";

# End table
print "</table>\n";
print "\n";

# End document body
print "</body>\n";

# End HTML
print "</html>\n";
