| 1 |
NAME |
| 2 |
HTTP::Request::Params - Retrieve GET/POST Parameters from HTTP Requests |
| 3 |
|
| 4 |
SYNOPSIS |
| 5 |
use HTTP::Request::Params; |
| 6 |
|
| 7 |
my $http_request = read_request(); |
| 8 |
my $parse_params = HTTP::Request::Params->new({ |
| 9 |
req => $http_request, |
| 10 |
}); |
| 11 |
my $params = $parse_params->params; |
| 12 |
|
| 13 |
DESCRIPTION |
| 14 |
This software does all the dirty work of parsing HTTP Requests to find |
| 15 |
incoming query parameters. |
| 16 |
|
| 17 |
new |
| 18 |
my $parser = HTTP::Request::Params->new({ |
| 19 |
req => $http_request, |
| 20 |
}); |
| 21 |
|
| 22 |
"req" - This required argument is either an "HTTP::Request" object or a |
| 23 |
string containing an entire HTTP Request. |
| 24 |
|
| 25 |
Incoming query parameters come from two places. The first place is the |
| 26 |
"query" portion of the URL. Second is the content portion of an HTTP |
| 27 |
request as is the case when parsing a POST request, for example. |
| 28 |
|
| 29 |
params |
| 30 |
my $params = $parser->params; |
| 31 |
|
| 32 |
Returns a hash reference containing all the parameters. The keys in this |
| 33 |
hash are the names of the parameters. Values are the values associated |
| 34 |
with those parameters in the incoming query. For parameters with |
| 35 |
multiple values, the value in this hash will be a list reference. This |
| 36 |
is the same behaviour as the "CGI" module's "Vars()" function. |
| 37 |
|
| 38 |
req |
| 39 |
my $req_object = $parser->req; |
| 40 |
|
| 41 |
Returns the "HTTP::Request" object. |
| 42 |
|
| 43 |
mime |
| 44 |
my $mime_object = $parser->mime; |
| 45 |
|
| 46 |
Returns the "Email::MIME" object. |
| 47 |
|
| 48 |
Now, you may be wondering why we're dealing with an "Email::MIME" |
| 49 |
object. The answer is simple. It's an amazing parser for MIME compliant |
| 50 |
messages, and RFC 822 compliant messages. When parsing incoming POST |
| 51 |
data, especially file uploads, "Email::MIME" is the perfect fit. It's |
| 52 |
fast and light. |
| 53 |
|
| 54 |
SEE ALSO |
| 55 |
"HTTP::Daemon", HTTP::Request, Email::MIME, CGI, perl. |
| 56 |
|
| 57 |
AUTHOR |
| 58 |
Casey West, <[email protected]>. |
| 59 |
|
| 60 |
COPYRIGHT |
| 61 |
Copyright (c) 2005 Casey West. All rights reserved. |
| 62 |
This module is free software; you can redistribute it and/or modify it |
| 63 |
under the same terms as Perl itself. |
| 64 |
|