HTTP::Query - Class designed to allow easy manipulation of query strings
require HTTP::Query; my $q = HTTP::Query.new(); $q.parse_params('foo=bar&baz=quux'); my $params = $q.params(); # or `$q.param()` (for backward compatibility) my $foo = $q.param('foo'); $q.param('foo') = <an array of values>; # or `$q.param('foo', 'an', 'array', 'of', 'values');` $q.delete('foo'); $q.clear();
An object of this class represents the query string portion of a requested URI. It provides the following methods:
$q.parse_params($data)
Parses the given string, seperating it into 'name' and 'value' pairs. This method should be called before any other methods, as it initialises the list of parameters.
$q.params()
Returns the names of all the parameters as a list. The order in which they were present in the query string is preserved.
$q.param()
This exists as an alias for params.
params
$q.param($name)
Returns the value of the parameter named $name. If called in List context, it will return a list of values. Otherwise, it will return the first value.
$name
$q.param($name, $val1, $val2...)
$q.param($name) = @vals
Assigns @vals to the parameter named $name.
@vals
$q.delete($name)
Deletes the parameter named $name.
$q.clear()
Deletes all the parameters.
"Aankhen"
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
To install Perl6::Pugs, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perl6::Pugs
CPAN shell
perl -MCPAN -e shell install Perl6::Pugs
For more information on module installation, please visit the detailed CPAN module installation guide.