Re: mod_perl and global %Live_Objects not being initialized

[prev] [thread] [next] [Date index for 2004/11/16]

From: William McKee
Subject: Re: mod_perl and global %Live_Objects not being initialized
Date: 14:39 on 16 Nov 2004
On Mon, Nov 15, 2004 at 04:40:40PM -0500, Andy Grundman wrote:
> I have one copy of my Class::DBI objects in each Apache child.  Each one 
> of these objects maintains an object index in the global variable 
> %Live_Objects.  Since this variable is never initialized by default, the 
> object index is maintained between requests...

I'm pretty sure this is by design.


> ... causing stale data to be 
> returned instead of forcing a fresh SELECT from the database.  In a CGI 
> application the variable will never contain any data, but in mod_perl 
> the data is left over from the previous request.

The only thing that would cause your data to stick around is maintaining
a variable that refers to one of the objects in %Live_Objects. This can
be done via a global variable (which it sounds like you don't have) or a
closure (which is surprisingly easy to create).

I've posted a solution in the wiki[1] which gives several suggestions
for debugging this problems. I've dealt with them more than I'm willing
to admit :).


Good luck,
William

[1] http://www.class-dbi.com/cgi-bin/wiki/index.cgi?CommonProblems
     (it's currently the last entry on the page)

        -- 
        Knowmad Services Inc.
http://www.knowmad.com

(message missing)

Re: mod_perl and global %Live_Objects not being initialized
William McKee 14:39 on 16 Nov 2004

Re: mod_perl and global %Live_Objects not being initialized
=?ISO-8859-1?Q?Ask_Bj=F8rn_Hansen?= 03:02 on 19 Nov 2004

Generated at 17:31 on 15 Feb 2005 by mariachi v0.52