Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
My attempt using the CGI param method hopefully to bring this script up to date using the CGI module:use strict; sub parse_form { # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs my @pairs = split(/&/, $buffer); my $name; my $value; foreach my $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } }
Please advise what I am doing wrong because it doesnt want to work?use strict; use CGI qw(:standard); sub parse_form { # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs my @pairs = split(/&/, $buffer); my $name; my $value; foreach my $pair (@pairs) { foreach my $stuff (param($pair)) { ($name, $value) = split(/=/, $stuff); $FORM{$name} = $value; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using CGI param method
by sgifford (Prior) on Apr 20, 2004 at 16:55 UTC | |
by Belgarion (Chaplain) on Apr 20, 2004 at 17:03 UTC | |
by sgifford (Prior) on Apr 20, 2004 at 17:51 UTC | |
by TilRMan (Friar) on Apr 21, 2004 at 05:24 UTC | |
by Anonymous Monk on Apr 20, 2004 at 17:43 UTC | |
by sgifford (Prior) on Apr 20, 2004 at 17:53 UTC | |
by Anonymous Monk on Apr 21, 2004 at 11:50 UTC | |
by sgifford (Prior) on Apr 21, 2004 at 15:12 UTC |