in reply to mod_perl and cgi detente

Are there specific issues you're dealing with? If you build your app on CGI.pm (or CGI::Application etc), use DBI with Apache::DBI or some other persistance-checking technique and load your modules as early as possible you've probably got most of the performance enhancements for free without doing anything apache specific - ie. your code should work both as CGI and as Apache::Registry modules.

Replies are listed 'Best First'.
Re^2: mod_perl and cgi detente
by derby (Abbot) on Mar 26, 2007 at 19:48 UTC

    I'm looking into building a Sessions module that can sit over a namespace (mod_perl) or be called from a cgi script (before or after the CGI creation) -- So I'm looking to do a Foo::Session instead of Foo::Session::Apache and Foo::Session::Cgi. Now if the session was simple, it would be straightforward (get cookie, set cookie); however, sometimes I need to store GET params in the session and I may need to redirect if the session is invalid. So sometimes I have an Apache request object to deal with sometimes, a CGI object.

    -derby
      Are you sure you will need to go through all that trouble? CGI is aware of mod_perl, and will use the appropriate Apache modules under the hood. You can even access the request object through $cgi->r.

      I would just write the code as if it's going to run as plain CGI, and let CGI.pm and mod_perl handle their environment for me.