[Catalyst] The View helper
Andy Grundman
andy at hybridized.org
Tue Aug 16 17:18:34 CEST 2005
Zbigniew Lukasiak wrote:
> sub end : Private {
> my ( $self, $c ) = @_;
> $c->forward($AppName . '::V::TT') unless $c->res->output;
> }
Sounds like a good idea. Just for the record, the following is the
current best-practice code to put in your end method:
return 1 if $c->res->status =~ /^3\d\d$/;
return 1 if $c->res->body;
$c->res->content_type( 'text/html; charset=utf-8' )
unless ( $c->res->content_type );
$c->forward( 'MyApp::V::TT' );
And there are a couple of optional things you can put in as well, such
as a custom error message page [1], and a debug die parameter.
-Andy
[1]
http://search.cpan.org/dist/Catalyst/lib/Catalyst/Manual/Cookbook.pod#Delivering_a_Custom_Error_Page
More information about the Catalyst
mailing list