Amon2::Web - Web Application Base.
package MyApp; use parent qw/Amon2/; package MyApp::Web; use parent qw/MyApp Amon2::Web/;
This is a web application base class.
$c->create_request()
Create new request object from $c.
$c
You can override this method to change request object's class.
$c->create_response($code, \@headers, \@body)
Create new response object.
You can override this method to change response object's class.
$c->create_view()
Create new view object. View object should have $view->render(@_) method.
$view->render(@_)
You can override this method to change view object's class.
$c->dispatch() : Plack::Response
Do dispatch request. This method must return instance of Plack::Response.
You can override this method to change behavior.
$c->html_content_type() : Str
Returns default Content-Type value for the HTML response.
$c->request() : Plack::Request
$c->req() : Plack::Request
This is a accessor method to get the request object in this context.
$c->redirect($location : Str, \%parameters) : Plack::Response
Create a response object to redirect for $location with \%parameters.
$location
\%parameters
$c->redirect('/foo', +{bar => 3})
is same as following(if base URL is http://localhost:5000/)
$c->create_response(302, [Location => 'http://localhost:5000/foo?bar=3'])
$c->res_403()
Create new response object which has 403 status code.
$c->res_404()
Create new response object which has 404 status code.
$c->res_405()
Create new response object which has 405 status code.
$c->create_simple_status_page($code, $message)
Create a new response object which represents specified status code.
MyApp->to_app() : CodeRef
Create an instance of PSGI application.
$c->uri_for($path: Str, \%args) : Str
Create URI from $path and \%args.
$path
\%args
This method returns relative URI.
$c->render($tmpl[, @args|%args]) : Plack::Web::Response
This method renders HTML.
$c->encoding()
Return a encoding object using Encode::find_encoding().
Encode::find_encoding()
$c->encode_html($html) : Str
This method encodes HTML from bytes.
To install Amon2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Amon2
CPAN shell
perl -MCPAN -e shell install Amon2
For more information on module installation, please visit the detailed CPAN module installation guide.