PEF::Front::Response - HTTP response object
use PEF::Front::Response; use PEF::Front::Route; PEF::Front::Route::add_route( get '/' => sub { PEF::Front::Response->new( headers => ['Content-Type' => 'text/plain'], body => 'Hello World!' ); } );
PEF::Front::Response is a response class for your applications. Generally, you will want to create instances of this class only as exceptions or in special cases.
Returns a new Web::Response object. Valid parameters are:
The HTTP status code for the response.
The headers to return with the response. Can be provided as an arrayref, a hashref, or an PEF::Front::HTTPHeaders object.
The cookies to return with the response. Can be provided as an arrayref, a hashref, or an PEF::Front::Headers object.
The values of cookies can either be the string values of the cookies, or a hashref whose keys can be any of value, domain, path, expires, max-age, secure, httponly. Defaults to {}.
value
domain
path
expires
max-age
secure
httponly
{}
The content of the request. Can be provided as a string, an arrayref containing a list of either of strings, a filehandle, or code reference. Defaults to ''.
''
Base URL for incomplete redirect location.
PEF::Front::Request object to import base, headers and cookies from.
base
headers
cookies
Sets (and returns) the status attribute, as described above.
Adds response header. This action allows to have multiple headers with the same name.
Sets response header. This action ensures that there's only one header with given name in response.
Removes header.
Returns header.
Sets cookie value.
Removes cookie.
Returns get_cookie.
Sets response body. It can be string, array of strings, file handle or code reference.
Adds response body chunk.
Returns response body.
Response will redirect browser to new location.
Sets 'Content-Type'
Makes 'expires' cookie attribute. $expires is time interval parseable by Time::Duration.
Makes all response headers.
Returns a valid PSGI response, based on the values given.
This module was written and is maintained by Anton Petrusevich.
Copyright (c) 2016 Anton Petrusevich. Some Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install PEF::Front, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PEF::Front
CPAN shell
perl -MCPAN -e shell install PEF::Front
For more information on module installation, please visit the detailed CPAN module installation guide.