NAME
Eve::HttpResponse - an HTTP response adapter.
SYNOPSIS
use Eve::HttpResponse;
my $response = Eve::HttpResponse->new(nph_mode => 0);
$response->set_status(code => 302);
$response->set_header(name => 'Location', value => '/other');
$response->set_cookie(
name => 'cookie1',
value => 'value',
domain => '.example.com',
path => '/some/',
expires => '+1d',
secure = >1);
$response->set_body(text => 'Hello world!');
print $response->get_text();
DESCRIPTION
The class is an adapter for the Plack::Request module. It is used to store the response data before it is being sent to the client.
METHODS
init()
set_header()
Sets or overwrites an HTTP header of the response.
Arguments
name
value
set_status()
Sets or overwrites the HTTP response status.
Arguments
code
set_cookie()
Sets an HTTP response cookie.
Arguments
name
value
domain
path
expires
-
(optional) a cookie expiration time in the epoch format
secure
-
(optional) defaults to false
set_body()
Sets or overwrites the HTTP response body.
Arguments
text
get_text()
Returns
The HTTP response as text.
get_raw_list()
Returns
The passthrough method for the Plack::Request finalize
method.
SEE ALSO
LICENSE AND COPYRIGHT
Copyright 2012 Igor Zinovyev.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.