[thelist] CGI VARIABLES

dwayne dwayne at mentia.com
Fri, 7 Jan 2000 16:15:02 -0700 (MST)


Adrian Fischer writes:
 > Greetings all,
 > 
 > Off the top of your head is there a way I can get a print of all the variables being used
 > withing a cgi script i.e. what is assigned to them at a given time?

Got just the thing. Point your browser at this:

#! /usr/bin/perl -w

use strict;

print "Content-Type: text/html\n\n";

print '<html><head><title>Environment Variables</title></head>';
print '<body bgcolor="#ffffff">';
print '<table border="0">';

for my $key ( keys(%ENV) ) {

    print '<tr><td><font face="arial, helvetica, sans serif" size="2">';
    print $key;
    print '</td><td><font face="arial, helvetica, sans serif" size="2">';
    print $ENV{$key};
    print '</td></tr>';
}

print '</table></body></html>';

__END__


- dwayne