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: 17:15 on 16 Nov 2004
On Tue, Nov 16, 2004 at 10:33:55AM -0500, Andy Grundman wrote:
> Unless you are doing nothing by selects on your database, you will have 
> problems, though.

That has not been my experience but I'm not that familiar how Perrin
coded this feature.


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

FWIW, I've been "pretty certain" that my objects were being destroyed as
well but then discovered accidental closures which maintained the stale
data from the object index.

Hopefully Perrin will have some insight on initializing the
%Live_Objects. I wouldn't think that it'd be the right thing to do as
the object index would always be wiped out and thus provide none of the
performance benefits it was meant to give.


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

Have you tried placing that call at the end of your code? I can't see
where it would make any difference the first time through. Have you
tried running your code via Apache::PerlRun or mod_cgi (if it's an
Apache::Registry script)? Does the problem still exist?

I'm not saying your solution is right or wrong; just that my experiences
have been different. I haven't needed to explicitly clear the hash once
I properly fixed my code.


William

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

(message missing)

Re: mod_perl and global %Live_Objects not being initialized
William McKee 17:15 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