[Catalyst] stripping path parts and then redispatch?

Jason Gottshall jgottshall at capwiz.com
Mon Feb 23 18:21:14 GMT 2009


Larry Leszczynski wrote:
> Hi Lars -
> 
>>> I have an existing site, and want to add the page language to the URLs
>>> so that caching will work correctly, e.g. "/foo/bar" would now look like
>>> "/en/foo/bar" or "/fr/foo/bar".
>> Apart from the missing true return value from auto, this works:
>>
>> http://lists.scsys.co.uk/pipermail/catalyst/2009-February/021072.html
> 
> Thanks for the pointer.  But this approach only seems to work for Local
> actions, not Private actions like default().  E.g. using these
> controllers:
> 
> #------------------------------------------------
> 
> package MyApp::Controller::Foo;
> use parent 'Catalyst::Controller';
> 
> sub default :Private {
>     my ($self, $c, @args) = @_;
>     $c->response->body("Foo args: @args");
> }

That construct is deprecated. You can do basically the same thing with:

   sub default : Path {
       ...
   }

See:
http://search.cpan.org/dist/Catalyst-Manual/lib/Catalyst/Manual/Intro.pod#Built-in_Private_Actions

-- 
Jason Gottshall
jgottshall at capwiz.com




More information about the Catalyst mailing list