[Catalyst] How to manage error 404
samwyse
samwyse at gmail.com
Wed Jun 29 16:59:39 CEST 2005
On 6/28/05, Albert Vila <avp at imente.com> wrote:
> I've I do this, how can I serve the default http://localhost:3000 ?
I create Path and RegEx subroutines that will catch everything that's
supposed to work, and only use 'default' to handle the 404's:
sub my_root : Path('/') {
# this should handle http://localhost:3000/
}
sub default : Private {
my ( $self, $c ) = @_;
$c->res->status(404);
$c->res->content_type('text/plain');
my ( $method, $protocol, $uri, $referer ) = (
$c->request->method,
$c->request->protocol,
$c->request->uri,
$c->request->referer,
);
$c->res->output(
"Your $method request for $uri via $protocol failed.\n\n" .
( $referer ?
"If possible, please update $referer" :
"Please try again." )
);
}
More information about the Catalyst
mailing list