version 1.13, 2013/05/13 01:26:54
|
version 1.15, 2016/08/01 15:19:05
|
Line 200 END
|
Line 200 END
|
|
|
=cgi_getitems() |
=cgi_getitems() |
|
|
Inputs: $query (the CGI query string), and $getitems, a reference to a hash |
Inputs: $query - the CGI query string (required) |
|
$getitems - reference to a hash (required) |
|
$possname - permitted names of keys (optional) |
|
|
Returns: nothing |
Returns: nothing |
|
|
Line 213 Side Effects: populates $getitems hash r
|
Line 215 Side Effects: populates $getitems hash r
|
############################################# |
############################################# |
############################################# |
############################################# |
sub cgi_getitems { |
sub cgi_getitems { |
my ($query,$getitems)= @_; |
my ($query,$getitems,$possnames)= @_; |
foreach (split(/&/,$query)) { |
foreach (split(/&/,$query)) { |
my ($name, $value) = split(/=/,$_); |
my ($name, $value) = split(/=/,$_); |
$name = &unescape($name); |
$name = &unescape($name); |
|
if (ref($possnames) eq 'ARRAY') { |
|
next unless (grep(/^\Q$name\E$/,@{$possnames})); |
|
} |
$value =~ tr/+/ /; |
$value =~ tr/+/ /; |
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; |
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; |
push(@{$$getitems{$name}},$value); |
push(@{$$getitems{$name}},$value); |
Line 246 sub cgi_header {
|
Line 251 sub cgi_header {
|
if ($contenttype ne '') { |
if ($contenttype ne '') { |
if ($mimetypes->type($contenttype) ne '') { |
if ($mimetypes->type($contenttype) ne '') { |
$headers{'-type'} = $contenttype; |
$headers{'-type'} = $contenttype; |
|
if ($contenttype =~ m{^text/}) { |
|
$headers{'-charset'} = 'utf-8'; |
|
} |
} |
} |
} |
} |
if ($nocache) { |
if ($nocache) { |