[Catalyst] How to manage error 404

Rob Kinyon rob.kinyon at gmail.com
Tue Jun 28 14:41:39 CEST 2005


On 6/28/05, Sebastian Riedel <sri at oook.de> wrote:
> 
> Am 28.06.2005 um 12:02 schrieb Chisel Wright:
> 
> > On Tue, Jun 28, 2005 at 11:52:23AM +0200, Albert Vila wrote:
> >
> >> I've I do this, how can I serve the default http://localhost:3000 ?
> >>
> >>
> >>> sub default : Private {
> >>>   my ( $self, $c ) = @_;
> >>>     # use the default 404 page for the server
> >>>   $c->res->status(404);
> >>>     # make sure we have no action
> >>>   $c->req->action(undef);
> >>> }
> >>>
> >
> >  sub default : Private {
> >   my ( $self, $c ) = @_;
> >
> >   if ($c->req->action eq 'default') {
> >    $c->forward($whatever);
> >   }
> >
> >   $c->res->status(404);
> >   $c->req->action(undef);
> >  }
> >
> > perhaps?
> 
> I would just use:
> 
>      sub default : Private {
>          my ( $self, $c, $something ) = @_;
>          if ($something) {
>              $c->res->status(404);
>              # ...
>          }
>          else {
>              # do something to handle root
>          }
>      }
> 

What would you do if you wanted to decline handling the request, mark
it as 404, and let Apache do its thing?

Rob



More information about the Catalyst mailing list