| AnyEvent-HTTPD documentation | Contained in the AnyEvent-HTTPD distribution. |
AnyEvent::HTTPD::Util - Utility functions for AnyEvent::HTTPD
The functions in this package are not public.
Robin Redeker, <elmex@ta-sa.org>
Copyright 2009 Robin Redeker, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| AnyEvent-HTTPD documentation | Contained in the AnyEvent-HTTPD distribution. |
package AnyEvent::HTTPD::Util; use common::sense; require Exporter; our @ISA = qw/Exporter/; our @EXPORT = qw/parse_urlencoded url_unescape/;
sub url_unescape { my ($val) = @_; $val =~ s/\+/\040/g; $val =~ s/%([0-9a-fA-F][0-9a-fA-F])/chr (hex ($1))/eg; $val } sub parse_urlencoded { my ($cont) = @_; my (@pars) = split /[\&\;]/, $cont; $cont = {}; for (@pars) { my ($name, $val) = split /=/, $_; $name = url_unescape ($name); $val = url_unescape ($val); push @{$cont->{$name}}, [$val, '']; } $cont }
1;