[Catalyst] namespace problem

Moritz Onken onken at houseofdesign.de
Sat Nov 21 09:35:30 GMT 2009


Am 21.11.2009 um 16:34 schrieb gutta:

> 
> Hi,
> 
> I tried to use "use parent 'MyApp::Controller::Root';"
> 
> instead of use parent 'Catalyst::Controller'; in all my other
> controllers(for ex: User.pm).
> 
> The reason is that Root.pm is already inheriting Catalyst::Controller.
> 
> But when i do this catalyst dispatcher is considerting all controller
> actions in my other controllers under namespace ''.
> 
> But if i declare __PACKAGE__->config->{namespace} = 'user'; its working as
> expected.

You can try to set it to undef, so that the controller namespace magic can happen.
But not sure if this is working. Worth a try, though.

A better solution would be to create a base class MyApp::Controller::Base which does not set the namespace so that you only need to set it in the root controller.

moritz


More information about the Catalyst mailing list