All pastes #291663 Raw Edit

hillct

public text v1 · immutable
#291663 ·published 2006-12-25 16:07 UTC
rendered paste body
        my $buffer = $ENV{'QUERY_STRING'};
        if (length ($buffer) > 0){
                my @pairs = split(/[&;]/, $buffer);
                foreach my $pair (@pairs){
                        my ($name, $value) = split(/=/, $pair);
                        $name =~ 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;
                        if($self->{PARAMS}{$name}){
                                push(@{$self->{PARAMS}{$name}},$value);
                        } else { $self->{PARAMS}{$name} = $value; }
                }
        }