[Catalyst] base controller

Octavian Rasnita orasnita at gmail.com
Thu May 31 12:47:06 GMT 2007


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

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

in all the controllers that need using subroutines from the base controller?

If it is not, and if I just need to use:
use MyApp::Controller::Base;

how can I access the subroutines using OOP?

I don't want to access them with
MyApp::Controller::Base::subroutine($self, $c, ...);

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.
Is it ok to use "use lib ..." in the current controller for specifying the 
path to the lib directory?
(I don't really like to hard code that path, but I don't know another way).

Thank you very much for some clarifications.

Octavian




More information about the Catalyst mailing list