Re: mod_perl and global %Live_Objects not being initialized

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

From: Andy Grundman
Subject: Re: mod_perl and global %Live_Objects not being initialized
Date: 15:33 on 16 Nov 2004
William McKee wrote:
> 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.

Unless you are doing nothing by selects on your database, you will have 
problems, though.

> 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 think the problem comes from Class::DBI itself, by defining it as "my 
%Live_Objects;" but not initializing it.  I am pretty certain all of my 
own objects are being destroyed properly after each request, and even if 
not, they are certainly re-initialized properly on the next request.

> 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 :).

I did try these solutions, and clear_object_index ended up being the 
solution, when called immediately after initializing my Class::DBI 
object.  This is effectively the same as if Class::DBI were properly 
initializing the variable on its own.

-Andy

(message missing)

Re: mod_perl and global %Live_Objects not being initialized
Andy Grundman 15:33 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