CGI test example

#!/usr/local/bin/perl -- -*- perl -*-
#
# test.pl
# This script reflects the environment variables and form variables from 
#  a web page
# Written by Graeme Cross, 4/12/95 - v1.00
#

require 'cgi-lib.pl';

# read in the parameters from the browser
&ReadParse;

# print the top part of the web pages
print &PrintHeader;

print <<HEADING;

<TITLE>Web browser variables</TITLE>

<H1 ALIGN=center>Web browser variables</H1>

<H2>Environment variables:</H2>

<PRE>
HEADING

# print the environment variables
foreach $line (keys %ENV) {
  $value = $ENV{$line};
  write;
}

# print the middle of the web page
print <<MIDDLE;
</PRE>

<HR><BR>

<H2>Form variables:</H2>

<PRE>
MIDDLE

# print the form variables
foreach $line (keys %in) {
  $value = $in{$line};
  write;
}

# print the end of the web page
print <<ENDING;
</PRE>

<HR><BR>

ENDING

# define the output record format

format STDOUT =
@>>>>>>>>>>>>>>>>>>   @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$line		      $value
.



Perl & Linux

Updated: 4 December, 1995