Tuesday, July 7, 2009

[Catalyst] offset the URI of an existing Cat App

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

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@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/

0 comments: