Hello,

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:

our $app = Jugga::Application->new(
        PARAMS => {
                t       => $tmpl,
                t_prov  => $tmpl_provider,
        },
);

sub handler : method
{
        my ( $class, $r ) = @_;

        $app->param( r => $r );
        $app->run();

        return OK;
}

Is this going to work? The separation of new() and run() suggests to me that it should, but I've never seen it done this way before.

The application would have to create a new CGI object based on the 'r' parameter each time the handler is called (this would be done with cgiapp_get_query()). However, looking at the code for the query() method, it looks like that can't be changed once set. Would it be OK to delete $self->{__QUERY_OBJ} in teardown(), or am I going to be lynched just for suggesting it? ;-)


Thanks, Chad.

---------------------------------------------------------------------
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