[Catalyst] offset the URI of an existing Cat App

Ian Docherty catalyst at iandocherty.com
Tue Jul 7 15:17:48 GMT 2009


Octavian Râsnita wrote:
> From: "Ian Docherty" <catalyst at iandocherty.com>
>> Hi
>> I have always written Cat Apps so they start at the '/' URI but now I 
>> have been asked to 'offset' one so that:-
>>
>> /        becomes /foo
>> /user    becomes /foo/user
>> /admin/1 becames /foo/admin/1
> 
> Hi,
> 
> If using mod_perl, instead of:
> 
> <Location />
> SetHandler perl-script
> PerlResponseHandler MyApp
> </Location>
> 
> use:
> 
> <Location /foo>
> SetHandler perl-script
> PerlResponseHandler MyApp
> </Location>
> 
> And the application should work at the new location.
> 
Thanks, that did the trick. I was looking for something more complicated!

> But if in the templates you use urls like:
> 
> <a href="/user">...</a>
> 
> you need to change them to urls like:
> <a href="[% c.uri_for('/user') %]">...</a>
> 
> If you use fastcgi, instead of:
> 
> FastCgiExternalServer /tmp/myapp.fcgi -socket /tmp/myapp.socket
> Alias / /tmp/myapp.fcgi/
> 
> you could use:
> 
> FastCgiExternalServer /tmp/myapp.fcgi -socket /tmp/myapp.socket
> Alias /foo /tmp/myapp.fcgi/
> 
> Note! I know these only from theory, because I always needed to use apps 
> only at "/".
> 
> HTH.
> 
> Octavian
> 
> 
> 
>>
>> etc.
>>
>> I saw the __PACKAGE__->config->{namespace} that could be used but this 
>> would still require an entry in each of my controllers. e.g.
>>
>> package MyApp::Controller::Root;
>> ...
>> __PACKAGE__->config->{namespace} = 'foo';
>> ...
>>
>>
>> package MyApp::Controller::Admin;
>> ...
>> __PACKAGE__->config->{namespace} = 'foo/admin';
>> ...
>>
>>
>> etc. which strikes me as very unsatisfactory.
>>
>> I think I must have missed something. Is there a single point where I 
>> can make a change that will replicate through all my controllers? Can 
>> anyone put me right?
>>
>> Regards
>> Ian
>>
>> _______________________________________________
>> 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/ 
> 
> 
> _______________________________________________
> 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/
> 
> 




More information about the Catalyst mailing list