httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wilfredo Sanchez <>
Subject [PATCH] (Take II) CGI Tweak
Date Fri, 26 Jun 1998 04:05:36 GMT
Here's a fancier printenv script; displays environment in a simple table.  It's a little friendlier
to look at.

	 Apple Computer, Core Operating Systems Group, 408.974-5174
	 2 Infinite Loop 302-4K, Cupertino, CA 95014

#!/usr/bin/perl -T

# Show CGI Process Environment
# Wilfredo Sanchez |
# 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 debugging 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 4.0/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=\"mailto:wsanchez\\">"; # 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";

View raw message