[Catalyst] Forward on to other actions after removing first path segment?

Dorian Taylor (Lists) dorian.taylor.lists at gmail.com
Mon Nov 15 19:10:56 GMT 2010


Hi Larry,

On 15-Nov-10, at 10:55 AM, Larry Leszczynski wrote:

> Hi Dorian -
>
>> OK, but the part that confuses me is why /foo doesn't resolve to
>> MyApp::Foo::index with ->go or ->visit.
>
> Maybe this will help (I think in this case "index" works like
> "default"):
>
>   http://wiki.catalystframework.org/wiki/wikicookbook/safedispatchusingpath


According to your wiki page, my solution is thus:

package MyApp;

sub _date :Regex('^(\d{4}-\d{2}-\d{2})(.*)$') {
     my ($self, $c) = @_;
     my ($date, $rest) = @{$c->req->captures};
     $c->req->path($rest);
     $c->dispatcher->prepare_action($c);
     $c->go($c->action, $c->req->args);
}

This exhibits exactly the behaviour I was looking for.

Thanks,

--
Dorian Taylor
Make things. Make sense.
http://doriantaylor.com




More information about the Catalyst mailing list