[Catalyst] url parsing and sub controller
Danijel Milicevic
Danijel.Milicevic at rawmode.org
Mon Sep 5 19:00:19 CEST 2005
Hi Bernard,
Am Montag, den 05.09.2005, 18:00 +0200 schrieb Bernard FRIT:
> Probably a dumb question ...
Wise of the day: there are no dump questions, just dumb answers by gabb ;)
> sub begin : Private {
> my ( $self, $c , $categ) = @_;
> if ($categ) {
> $c->stash->{title} = "Category = $categ";
> return 1;
> }
> }
>
> when typing "domaine.tld /categ/MyCategory" I was expecting having
> $categ = MyCategory but I only have $categ=categ so I needed
> my ( $self, $c , $dummy, $categ) = @_;
> to get the correct value. Is it correct behavior ?
>
> More, I can't figure out why after executing begin, Catalyst execute
> default and redirect to "/default_action" ?
You might wanna check the docs for the "begin" action and its function.
Don't use it for this kinda thing, you a dedicated *public* action to
handle arguments.
What probably happened was:
1) You ask for domain.tld/categ/MyCategory
2) There is neither a *public* action named categ, nor a local action
named MyCategory in the controller Categ, so what happens next is:
3) of course your default action will be called and so on
Just write a sub categ : Global {}, put the code in it and it will work.
Regards,
Danijel "gabb" Milicevic
More information about the Catalyst
mailing list