[Catalyst] Validating single arg id
iain
iainhubbard at googlemail.com
Wed Oct 21 14:17:00 GMT 2009
Zbigniew Lukasiak wrote:
> What is the advantage of this over:
>
> sub view : Local {
> my ( $self, $c, $id ) = @_;
> $self->start( $c, $id );
> # do something with $c->stash->{obj}
> return 1;
> }
>
>
>
For me there are lots of little reasons. I suppose its a personal choice.
I like the URI structure better and chained makes me think about the URI
more.
I prefer /item/1234/view to /item/view/1234 as it lets you add more
functionality in an intuitive way:
/item/1234/edit
/item/1234/delete
etc...
and if the user just deletes the edit/view part of the uri you can do
something sensible.
Other people in the team can just chuck a new action on the URI without
wondering what I called my validation routine.
It prints a nice URI dispatch table in debug mode.
As I said, for me its lots of little reasons that just feel right. But
mainly its about the URI structure.
Iain.
p.s. What Aristotle said.
More information about the Catalyst
mailing list