# A simple HTTP request parser to emulate ASP request.xxx< # So you can do $request->{"clicked"} in place of Request("clicked") # Has problems with MIME or complex submits # sub getHTTPData { my $xx; my $buffer; my %vars; if($ENV{"REQUEST_METHOD"} eq "GET") { $buffer=$ENV{'QUERY_STRING'}; } else { read ( STDIN, $buffer, $ENV{"CONTENT_LENGTH"}); } foreach $pair (split(/&/, $buffer)) { $pair =~ tr/+//; ($name, $value) = split(/=/, $pair); $value =~ s/%(\w\w)/sprintf("%c", hex($1))/ge; # convert hex to ascii $value=~s/\+/ /g; $vars{$name}="$value"; } return \%vars; } #### use CGI ':standard'; print "Content-type: text/html\n\n"; print ""; foreach my $name ( param() ) { my @values = param ($name); print "

Key: $name Value(s): @values"; } #### $request = getHTTPData(); print "
fromtime is ". $request->{"fromTime"}; ##
## for each fld in request.form # do stuff with the name and value next #### foreach fld in formdata{ make a variable named $fld have a value of $value }