#!/usr/local/bin/perl # # testCGI_LIB.cgi -- This perl CGI script will print out the submitted data. # # Last modified : 26th.Aug.1998 # # Simon Tneoh Chee-Boon tneohcb@pc.jaring.my # # Copyright (c) 1998 Simon Tneoh Chee-Boon. All rights reserved. # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. # use strict; use Carp; # # We use the CGI_LIB module and create an object to store the data. # use CGI_LIB; my($cgi) = new CGI_LIB; # # Users want to know how to get the submitted data. # # # Print the HTTP header and HTML tags. # print "Content-Type: text/html\n\n"; print "\n"; print "
\n"; print "\n"; # # We will print out all the submitted data now. # my($key); for $key (sort keys %{$cgi}) { print "\n"; print "\n"; print "
\n"; my($ref) = ref($cgi->{$key}); if ($ref eq "HASH") { # # This is a hash array. # printTableHead("Hash Array", $key); for (keys %{$cgi->{$key}}) { printTableRow("\$cgi->{'$key'}->{'$_'}", $cgi->{$key}->{$_}); } } elsif ($ref eq "ARRAY") { # # This is an array. # printTableHead("Array", $key); my($count) = 0; for (@{$cgi->{$key}}) { printTableRow("\$cgi->{'$key'}\[$count\]", $cgi->{$key}[$count]); $count++; } } else { # # This is just a normal variable which contains only one value. # printTableHead("Single Value", $key); printTableRow("\$cgi->{'$key'}", $cgi->{$key}); } print " \n"; } print "