1XS(3) User Contributed Perl Documentation XS(3)
2
3
4
6 CGI::Deurl::XS - Fast decoder for URL parameter strings
7
9 use CGI::Deurl::XS 'parse_query_string';
10
11 my $hash = parse_query_string('foo=bar&baz=quux&baz=qiix');
12 # $hash = { 'foo' => 'bar', 'baz' => ['quux', 'qiix'] };
13
15 This module decodes a URL-encoded parameter string in the manner of
16 CGI.pm. However, as it uses C code from libapreq to perform the task,
17 it's somewhere from slightly to much faster (depending on your strings)
18 than using CGI or a functionally similar module like CGI::Deurl.
19
21 parse_query_string()
22 $hash_ref = CGI::Deurl::XS::parse_query_string($query_string)
23
24 Parses the given query string. If the string is empty, returns
25 undef. Otherwise returns a hash reference containing the key/value
26 pairs encoded by the string. Empty values are returned as undef.
27 If a parameter appears only once, it's value in the hash is the
28 scalar value of the encoded parameter value. If a parameter appears
29 more than once, the hash value is an array reference containing
30 each value given (with value order preserved). Obviously, parameter
31 order is not preserved in the hash.
32
33 HTTP escapes (ASCII and Unicode) are decoded in both keys and
34 values. The utf8 flag is not set on returned strings, nor are
35 non-utf8 encodings decoded.
36
38 None by default, parse_query_string at request.
39
41 CGI
42
43 libapreq
44
46 Adam Thomason, <athomason@sixapart.com>
47
49 Copyright (C) 2008 by Six Apart Ltd <cpan@sixapart.com>
50
51 This library is free software; you can redistribute it and/or modify it
52 under the same terms as Perl itself, either Perl version 5.8.6 or, at
53 your option, any later version of Perl 5 you may have available.
54
55
56
57perl v5.32.1 2021-01-26 XS(3)