[Catalyst] Multiple path for the same action

Julien Sobrier julien at sobrier.net
Fri Feb 19 05:10:51 GMT 2010


Thank you for pointing me to the right direction.

It looks like I could associates a new path with existing actions by
accessing $c->dispatcher

Julien

On Wed, Feb 17, 2010 at 10:47 PM, Eden Cardim <edencardim at gmail.com> wrote:

>
>    Julien> I want to let users decide how to name their URL.  For
>    Julien> example, by default, the url looks like this: /home/Julien
>
>    Julien> But people can decide to change /home with anything they
>     Julien> want through an administration panel: /name/Julien
>     Julien> /first-name/Julien /my-website/Julien etc.
>
> The politically correct way to do it would be to create your own
> dispatch type. See Catalyst::DispatchType and the built-in dispatch
> types (Catalyst::DispatchType::*) for that.
>
> Or, a simpler way to hack it in would be:
>
> sub foo :Chained('/') PathPart('') Args(2) {
>    my($self, $c, $prefix, $username) =3D @_;
>    $c->user->check_prefix($prefix) or $c->detach('/error_404');
> }
>
> Also, make sure you store the old prefixes and redirect to the new ones
> adequately as to not break the web.
>
> --
>   Eden Cardim       Need help with your Catalyst or DBIx::Class project?
>  Code Monkey                    http://www.shadowcat.co.uk/catalyst/
>  Shadowcat Systems Ltd.  Want a managed development or deployment platfor=
m?
> http://edenc.vox.com/            http://www.shadowcat.co.uk/servers/
>
>
> _______________________________________________
> 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/20100218/63fbf=
0ef/attachment.htm


More information about the Catalyst mailing list