![]() |
Cooked Input |
| |
The associative array CookedInput represents
a request from the client as any number of
StandardKeys and their associated values.
The server sends us as a string of key=value pairs
separated by &s.
First we restore spaces, which are encoded as +.
(Hoisted out of the loop. --DaveSmith)
$RawInput =~ s/\+/ /g;Next we examine each pair in turn. foreach $_ (split(/&/, $RawInput)) {And restore characters that are encoded as %hh (where hh is the hex value of the encoded character).
s/\%(..)/pack(C, hex($1))/ge;
Now is a good time to blatantly discard any
troublesome characters that
we give meaning to elsewhere.
s/$FieldSeparator//go;
We use here //o to save a bit of time. --VladimirAlexiev, just being Perly-anal. Now we can split the pair around the first =
and store the value we get (if any) under its
corresponding key.
If there is no = then the key is set to true.
($_, $CookedInput) = split (/=/, $_, 2);
$CookedInput{$_} = $CookedInput;
}
|
| Last edited February 10, 1998 Return to WelcomeVisitors |