CGI::Deurl::XS - Fast decoder for URL parameter strings
use CGI::Deurl::XS 'parse_query_string'; my $hash = parse_query_string('foo=bar&baz=quux&baz=qiix'); # $hash = { 'foo' => 'bar', 'baz' => ['quux', 'qiix'] };
This module decodes a URL-encoded parameter string in the manner of CGI.pm. However, as it uses C code from libapreq to perform the task, it's somewhere from slightly to much faster (depending on your strings) than using CGI or a functionally similar module like CGI::Deurl.
$hash_ref = CGI::Deurl::XS::parse_query_string($query_string)
Parses the given query string. If the string is empty, returns undef. Otherwise returns a hash reference containing the key/value pairs encoded by the string. Empty values are returned as undef. If a parameter appears only once, it's value in the hash is the scalar value of the encoded parameter value. If a parameter appears more than once, the hash value is an array reference containing each value given (with value order preserved). Obviously, parameter order is not preserved in the hash.
HTTP escapes (ASCII and Unicode) are decoded in both keys and values. The utf8 flag is not set on returned strings, nor are non-utf8 encodings decoded.
None by default, parse_query_string at request.
CGI
libapreq
Adam Thomason, <athomason@sixapart.com>
Copyright (C) 2008 by Six Apart Ltd <cpan@sixapart.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.
To install CGI::Deurl::XS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::Deurl::XS
CPAN shell
perl -MCPAN -e shell install CGI::Deurl::XS
For more information on module installation, please visit the detailed CPAN module installation guide.