[Catalyst] base controller

Matt S Trout dbix-class at trout.me.uk
Thu May 31 13:19:06 GMT 2007


On Thu, May 31, 2007 at 02:47:06PM +0300, Octavian Rasnita wrote:
> Hi,
> 
> I want to use some subroutines in more controllers, and I think the best 
> idea would be to create a base controller that contains those subroutines.
> 
> Is it a good idea to create a
> MyApp::Controller::Base
> which is based on
> Catalyst::Controller

I'd create MyApp::ControllerBase::Whatever

> then to use
> use base MyApp::Controller::Base;

but yes, use base is the right way to go.

> When I am developing the controller modules, I use to run the current 
> module in order to see if it compiles successfully, for fixing the errors.
> If I use a controller in another controller, using "use" or "use base", the 
> program gives an error when trying to compile it, because it can't find the 
> controller it depends on.

perl -Ilib lib/MyApp/Controller/Foo.pm

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Catalyst mailing list