[Catalyst] Multiple path for the same action
Eden Cardim
edencardim at gmail.com
Thu Feb 18 06:47:19 GMT 2010
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) = @_;
$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 platform?
http://edenc.vox.com/ http://www.shadowcat.co.uk/servers/
More information about the Catalyst
mailing list