[Catalyst] namespace problem

Andrew Rodland andrew at cleverdomain.org
Sat Nov 21 10:00:42 GMT 2009


On Saturday 21 November 2009 02:34:07 am gutta wrote:
> 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.
> 
> my server debug logs are here http://scsys.co.uk:8001/36484
> 
> Do i need to explicitly define namespace in each and every controllers in
> that case or is there any other way to achieve it?
> 
For the sake of sanity, what you need to do is stop inheriting from a concrete 
controller. It really doesn't make a lot of sense and there are a lot of ways 
it could break something. As Moritz writes, if you need a controller base 
class, write a controller base class and inherit from that.

Andrew



More information about the Catalyst mailing list