Masatoshi Mizuno
and 1 contributors


Egg::Plugin::Response::ErrorDocument? - Plugin that outputs error document.


  package MyApp;
  use Egg qw/ Response::ErrorDocument /;
    plugin_response_errordocument=> {
      view_name     => 'mason',
      template      => 'error/',
      ignore_status => [qw/ 200 301 302 303 304 307 /],
      no_cache      => 1,


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.

  <title><% $e->page_title %></title>
  <h1><% $e->page_title %></h1>
  % 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, 
  % }

Such a template is preserved by a suitable name, and it sets it to 'template' of the 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/',

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,


Egg::Release, Egg::View, Egg::View::Mason, Egg::View::HT,


Masatoshi Mizuno <>


Copyright (C) 2008 Bee Flag, Corp. <>.

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.