
mohan at thebizmo
Nov 21, 2009, 5:46 AM
Post #4 of 8
(1226 views)
Permalink
|
Moritz Onken wrote: > > > 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 > _______________________________________________ > List: Catalyst [at] lists > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: > http://www.mail-archive.com/catalyst [at] lists/ > Dev site: http://dev.catalyst.perl.org/ > > Hi Mortiz, Thank you for your response. So you want me to write a MyApp/lib/Controller/Base.pm as follows. package MyApp::Controller::Base; use strict; use warnings; use parent 'Catalyst::Controller'; # # Sets the actions in this controller to be registered with no prefix # so they function identically to actions created in MyApp.pm # =head1 NAME MyApp::Controller::Base - Base Controller for MyApp =head1 DESCRIPTION [enter your description here] =cut 1; and will do "use parent 'MyApp::Controller::Base';" instead of my previous statement "use parent 'MyApp::Controller::Root';" Thank you. Best Regards, Mohan -- View this message in context: http://old.nabble.com/namespace-problem-tp26454140p26456702.html Sent from the Catalyst Web Framework mailing list archive at Nabble.com. _______________________________________________ List: Catalyst [at] lists Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst [at] lists/ Dev site: http://dev.catalyst.perl.org/
|