NAME

Egg::Plugin::ErrorDocument - Plugin that generates error screen.

SYNOPSIS

use Egg qw/ ErrorDocument /;

__PACKAGE__->egg_startup(
  ...
  .....

  plugin_error_document => {
    view_name => 'Template',
    template  => 'error.tmpl',
    include_ignore_status => 403,
    },

);

DESCRIPTION

It is a plugin to generate the error screens such as '404 Not Found' and '500 Server Error'.

The WEB server doesn't generate the error screen only with the return of the status code such as 404 when operating excluding the mod_perl environment. This plugin supplements it. Of course, it is possible to use it even in the mod_perl environment.

The error screen that this plugin intervenes is an error screen when processing can be normally completed. The error screen concerning the exception becomes the debugging screen of Egg.

The error screen is made by set arbitrary VIEW.

To acquire the status code easily on the VIEW side, following parameter is set.

VIEW-E<gt>param('status'),
VIEW-E<gt>param('status_[STATUS_CODE]'),

Especially, being able to do only the condition judgment by the presence of the value in HTML::Template can correspond by doing as follows.

<TMPL_IF NAME="status_404">
  ... 404 Not Found.
<TMPL_ELSE>
<TMPL_IF NAME="status_403">
  ... 403 Forbidden.
<TMPL_ELSE>
  ... 500 Internal Server Error.
</TMPL_IF>
</TMPL_IF>

CONFIGURATION

view_name => [VIEW_NAME]

VIEW to make the error screen is specified.

view_name => 'Mason',

* There is no default. When it is unspecification, the exception is generated.

template => [TEMPLATE]

The template of the error screen is specified.

It is a template for VIEW specified by 'View_name' and it is necessary to exist.

template => 'document/error.tt',

ignore_status => [STATUS_ARRAY],

The list of the status code of off the subject is specified.

Default is 200, 301, 302, 303, 304, 307,

ignore_status => [qw/ 200 301 302 303 304 307 403 /],

include_ignore_status => [STATUS_ARRAY],

List of status code added to 'ignore_status'.

include_ignore_status => 403,

SEE ALSO

Egg::View, Egg::View::Mason, Egg::View::Template, Egg::Release,

AUTHOR

Masatoshi Mizuno <lushe@cpan.org>

COPYRIGHT

Copyright (C) 2007 by Bee Flag, Corp. <http://egg.bomcity.com/>, All Rights Reserved.

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.