GX::View::Error - Default error view
package MyApp::View::Error; use GX::View::Error; __PACKAGE__->setup( default_format => 'html', default_encoding => 'utf-8' ); 1;
This module provides the GX::View::Error class which extends the GX::View class.
new
Returns the view component instance.
$view = $view_class->new;
$view ( GX::View::Error object )
$view
GX::Exception
All public methods can be called both as instance and class methods.
default_encoding
Returns the name of the default output encoding.
$encoding = $view->default_encoding;
$encoding ( string | undef )
$encoding
undef
An encoding name, for example "utf-8" or "iso-8859-1", or undef if the default output encoding is not defined. See Encode for a list of supported encodings.
default_format
Returns the default render format.
$format = $view->default_format;
$format ( string | undef )
$format
A format identifier, for example "html", or undef if the default render format is not defined.
render
If called in void context, render() renders the given error message or exception object and adds the result to the body of the response object that is associated with the given context object. Additionally, it sets the "Content-Type" header of the response to an appropriate value, unless that header has already been set.
render()
$view->render( %arguments );
context ( GX::Context object ) [ required ]
context
A context object. This argument is required in void context.
encoding ( string )
encoding
The name of the desired output encoding, for example "utf-8" or "iso-8859-1". See Encode for a list of supported encodings. If omitted, the default encoding (or "utf-8" as the final fallback) will be applied.
error ( GX::Exception object | string )
error
The exception object or error message to render. If omitted, the error attribute of the given context object or, if that attribute is undefined, a generic error message will be rendered.
format ( string )
format
The desired render format. Defaults to the default render format. Currently, only "html" is supported out of the box.
If called in non-void context, render() returns the rendered error message as a string of bytes.
$output = $view->render( %arguments );
context ( GX::Context object )
A context object. This argument is optional in non-void context.
See above.
$output ( byte string )
$output
setup
Sets up the view.
$view->setup( %options );
default_encoding ( string )
The name of the default output encoding, for example "utf-8" or "iso-8859-1". See Encode for a list of supported encodings. Defaults to the default encoding of the application.
default_format ( string )
The default render format. Defaults to "html". Currently, only "html" is supported out of the box.
GX::Exception::Formatter::HTML
Jörg A. Uzarek <uzarek@runlevelnull.de>
Copyright (c) 2009-2011 Jörg A. Uzarek.
This module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 as published by the Free Software Foundation.
To install GX, copy and paste the appropriate command in to your terminal.
cpanm
cpanm GX
CPAN shell
perl -MCPAN -e shell install GX
For more information on module installation, please visit the detailed CPAN module installation guide.