[Catalyst] Form handling, urls and web design

Zbigniew Lukasiak zzbbyy at gmail.com
Tue Jan 24 13:41:10 CET 2006


I think the default action is an remaining from some old catalyst days
when there was no index method, and to have an action for a directory
(an index action) you had to use default.
Now the only reasonable use for default is along the lines of:

sub default : Private {
    my ( $self, $c ) = @_;
    $c->response->status(404);
    $c->response->body("404 Not Found");
}

Anyone has a more complete 404 action?

-- Zbyszek

On 1/24/06, Brandon Black <blblack at gmail.com> wrote:
> On 1/24/06, Alex Kavanagh <alex at tinwood.homelinux.org> wrote:
> > At Mon, 23 Jan 2006 15:47:40 -0800,
> > Bill Moseley wrote:
> > > I stay away from default.  Use an empty path instead.
> >
> > Why do you stay away from default?
> >
>
> I still haven't rid my code of using default like that myself, but I
> think he's probably right about staying away from it being a Good Idea
> in general.  default will match anything, so you've made a whole class
> of mis-spelled URLs suddenly valid.  A typo (by the user or in your
> app) like "/myapp/users/dlete_user" should not map to a default sub
> which then implements or redirects to a list, but should rather give a
> proper 404 error.  And for a real action on "/myapp/users" implemented
> within users.pm, I believe the syntax is like:
>
> sub users_root : Path {
>     ...
> }
>
> -- Brandon
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
>


More information about the Catalyst mailing list