in reply to Re: mod_perl and cgi detente
in thread mod_perl and cgi detente

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

Replies are listed 'Best First'.
Re^3: mod_perl and cgi detente
by rhesa (Vicar) on Mar 26, 2007 at 20:32 UTC
    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.