Adam Thomason

NAME

CGI::Deurl::XS - Fast decoder for URL parameter strings

SYNOPSIS

  use CGI::Deurl::XS 'parse_query_string';

  my $hash = parse_query_string('foo=bar&baz=quux&baz=qiix');
  # $hash = { 'foo' => 'bar', 'baz' => ['quux', 'qiix'] };

DESCRIPTION

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.

FUNCTIONS

parse_query_string()
  $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.

EXPORT

None by default, parse_query_string at request.

SEE ALSO

CGI

libapreq

AUTHOR

Adam Thomason, <athomason@sixapart.com>

COPYRIGHT AND LICENSE

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.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 88:

You forgot a '=back' before '=head1'




Hosting generously
sponsored by Bytemark