Jesse Erlbaum wrote:
Hi Chad --


I'm thinking of using CGI::Application in a new project with mod_perl, and I know the two work together quite well... But I've only seen it done where the application object is instantiated and run at the same time from within the handler. This isn't the most efficient way to do it when using mod_perl.

What I would like to do is instantiate the object in the body of the handler's package, and reuse it over and over by setting the r parameter and calling $app->run(), like this:



That is not the way CGI::Application works. The CGI-App object expects to have a lifespan of exactly one request.

OK. I suspected that... but thought I'd ask just because of the "optics" of the two-step process of new() and then run().


You refer to "efficiency", and mod_perl.  CGI::Application was developed
from the start to work efficiently with mod_perl.  Using
Apache::Registry, the code is efficiently cached, so very little
unnecessary work is done between requests.
>
> If you believe there is any other inefficiency, please provide dprofpp
> profiling data to back up your theory.

No, I haven't done any benchmarks. The thing is, I just came from changing my use of Template Toolkit from one instance per request to a single instance (per Apache process) being reused across all requests. But now that I think about it, CGI::Application doesn't have anywhere near the startup overhead of Template Toolkit, so I agree the same principle doesn't apply here.


--

C. Chad Wallace
The Lodging Company
Public Key ID: 0x262208A0

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to