[Catalyst] offset the URI of an existing Cat App

Ian Docherty catalyst at iandocherty.com
Tue Jul 7 13:18:05 GMT 2009

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


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?


More information about the Catalyst mailing list