#!/usr/bin/perl -w
use strict;
# unbuffer STDOUT
$| = 1;
# get the name of this script
my($thisscript) = __FILE__; $thisscript =~ s/^.*(?:\\|\/|\:)//;
# string variable which will hold the %ENV data when we're done.
my($ENVIRONMENT_DATA) = '';
# gather values for each available environment variable
foreach (sort(keys(%ENV))) {
$ENV{$_} ||= ' ';
$ENVIRONMENT_DATA .= <<_env_
<tr>
<td>
<strong>$_</strong>
</td>
<td>
$ENV{$_}
</td>
</tr>
_env_
}
# print environment data and get outta' here
print(<<__HTML__ ) and exit;
Content-Type: text/html; charset=ISO-8859-1
<?xml version="1.0" encoding='ISO-8859-1'?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en"
lang="en">
<head>
<title>CGI environment details</title>
<meta
http-equiv="Content-Type"
content="text/html; charset=iso-8859-1" />
<meta
http-equiv="Expires"
content="0" />
<link
href="/css/style.css"
rel="stylesheet"
type="text/css" />
</head>
<body>
<div> </div>
<table
align="center"
width="90%"
cellspacing="1"
cellpadding="5"
border="1">
$ENVIRONMENT_DATA
</table>
<div> </div>
<div>
<a
href="$thisscript"
title="see HTTP_REFERER">see HTTP_REFERER</a>
</div>
<div>
<a
href="$thisscript/you/can/fake/a/pathname/after/the/script/name"
title="see PATH_INFO">see PATH_INFO</a>
</div>
<div>
<a
href="$thisscript?query string=(name/value pairs appended to a URL)"
title="see QUERY_STRING">see QUERY_STRING</a>
</div>
<div> </div>
</body>
</html>
__HTML__