[cgiapp] packages autouse?

P Kishor punk.kish at gmail.com
Thu Jun 11 12:21:16 EDT 2009


On Thu, Jun 11, 2009 at 11:11 AM, Porta<julian.porta at gmail.com> wrote:
> Hey, folks.
> Question:
> I was wondering if anyone else (than me) thinks is annoying to declare the
> "use" of all the required models (objects? packages?) you're using in your
> CA app?More, when working with CAD, on each controller you need to repeat
> use MyApp::Foo; use MyApp::Bar; etc.
>
> Assuming you're working with a persistent instance (means no need to do a
> cold start of your app on each request, so no problem to load all your app
> packages in memory) why not have *something* to manage the "use" of all the
> involved packages and reduce the repeated code on each package start.
>
> Thoughts?

Mark Stosberg's Titanium tries to get around that very problem by
doing all the use-ing for you. So, you just have to 'use Titanium'. On
the other hand, if you sub-class CGI::App, and then sub-class your
sub-class, you can do all the use-ing just once.

CGI::App <-- SuperSubClass with tons of use <-- Sub classes.

What I do find annoying is the number steps involved in adding a new
run mode, esp. when using CAD.

First, add the new run mode to the dispatch table.

Second, add the run mode to the setup in the module (assuming one is
not using AutoRunmode... some problems have been alluded to using
AutoRunmode, esp. in mod_perl environments.

Third, create the darn run mode.

Fourth, create the template for the run mode.

Dunno if there is a quicker way.





-- 
Puneet Kishor


More information about the cgiapp mailing list