[Catalyst] Multiple path for the same action

J. Shirley jshirley at gmail.com
Thu Feb 18 00:56:45 GMT 2010


On Wed, Feb 17, 2010 at 4:18 PM, Julien Sobrier <julien at sobrier.net> wrote:
> Hello,
> I'd like to assign multiple pass, at run-time, to the same action. For
> example:
>
> package MyApp::Controller::Foo;
>
> sub foo :Path {...}
>
> Then, have /foo, /bar, /other associated with MyApp::Controller::Foo->foo
>
> One way to do it woould be to catch /bar and /other in the "default" action,
> and forward it it to /foo. But this does not look like a clean solution. Any
> better way do achieve this?
>
> Thank you
> Julien


Sounds like you may want to use Chained, but your description isn't
really clear enough to answer for sure.

sub bar : Chained('/') PathPart('') CaptureArgs(0) { }
sub other : Chained('bar') PathPart('') CaptureArgs(0) { }
sub foo : Chained("other') PathPart(''foo) Args(0) { }

Calling /foo would call bar, then other and finally foo.

-J



More information about the Catalyst mailing list