
AnyEvent::HTTPD::Request - A web application request handle for AnyEvent::HTTPD

This is the request object as generated by AnyEvent::HTTPD and given in the request callbacks.

This method returns the URL of the current request.
This method will send a response to the request.
If no $res argument was given eventually accumulated output will be send as text/html.
Otherwise $res can be:
Then the array reference has these elements:
my ($code, $message, $header_hash, $content) =
[200, 'ok', { 'Content-Type' => 'text/html' }, '<h1>Test</h1>' }]
If it was a hash reference the hash is first searched for the redirect key and if that key does not exist for the content key.
The value for the redirect key should contain the URL that you want to redirect the request to.
The value for the content key should contain an array reference with the first value being the content type and the second the content.
Here is an example:
$httpd->reg_cb (
'/image/elmex' => sub {
my ($httpd, $req) = @_;
open IMG, "$ENV{HOME}/media/images/elmex.png"
or $req->respond (
[404, 'not found', { 'Content-Type' => 'text/plain' }, 'not found']
);
$req->respond ({ content => ['image/png', do { local $/; <IMG> }] });
}
);
Returns true if this request already has been responded to.
Returns the first value of the form parameter $key or undef.
Returns list of parameter names.
Returns a hash of form parameters. The value is either the value of the parameter, and in case there are multiple values present it will contain an array reference of values.
This method returns the method of the current request.
Returns the request content or undef if only parameters for a form were transmitted.

Copyright 2008 Robin Redeker, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.