[Catalyst] Multiple path for the same action

Julien Sobrier julien at sobrier.net
Thu Feb 18 01:34:31 GMT 2010


Thank you

But I cannot create these aliases at run-time, right?

Julien

On Wed, Feb 17, 2010 at 4:56 PM, J. Shirley <jshirley at gmail.com> wrote:

> 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->f=
oo
> >
> > 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
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100217/66eef=
b81/attachment.htm


More information about the Catalyst mailing list