NAME
Egg::Plugin::Response::ErrorDocument? - Plugin that outputs error document.
SYNOPSIS
package MyApp;
use Egg qw/ Response::ErrorDocument /;
__PACKAGE__->egg_startup(
...........
...
plugin_response_errordocument=> {
view_name => 'mason',
template => 'error/document.tt',
ignore_status => [qw/ 200 301 302 303 304 307 /],
no_cache => 1,
},
);
DESCRIPTION
It is a plugin to output the error screens such as '404 Not Found' and '500 Inta rnal Server Error'.
The template for this plugin is needed for use.
The template of the following content is assumed.
<html>
<head>
<title><% $e->page_title %></title>
</head>
<body>
<h1><% $e->page_title %></h1>
<div>
%
% if ($s->{status_401}) {
%
This server could not verify that you are authorized to access the document requested.
Either you supplied the wrong credentials (e.g., bad password),
or your browser doesn't understand how to supply the credentials required.
%
% } elsif ($s->{status_403}) {
%
You don't have permission to access on this server.
%
% } elsif ($s->{status_404}) {
%
The requested URL <% $e->request->path %> was not found on this server.
%
% } else {
%
The server encountered an internal error and was unable to complete your request.
Please contact the server administrator,
%
% }
%
</div>
</body>
</html>
Such a template is preserved by a suitable name, and it sets it to 'template' of the configuration.
CONFIGURATION
The configuration of this plugin is done by 'plugin_response_errordocument'.
view_name => [VIEW_NAME]
Name of view that error document outputs.
view_name => 'Mason',
template => [TEMPLATE]
Template used to output error document.
template => 'document/error.tt',
Thing that is template treatable by view specified by 'view_name'
ignore_status => [STATUS_ARRAY]
List of status code in which processing of this plugin is passed.
Default is 200,301,302,303,304,307.
ignore_status => [qw/ 200 301 302 303 304 307 403 /],
include_ignore_status => [STATUS_ARRAY]
STATUS_ARRAY is added to 'ignore_status'.
include_ignore_status => 403,
always_status ([STATUS_CODE])
When the error document is output, the response status is compulsorily made STATUS_CODE.
Especially, because it tries to output an original error document by the result code in mod_perl, it is necessary to always return the success code by this setting.
always_status => 200,
SEE ALSO
Egg::Release, Egg::View, Egg::View::Mason, Egg::View::HT,
AUTHOR
Masatoshi Mizuno <lushe@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2008 Bee Flag, Corp. <http://egg.bomcity.com/>.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.