Re: mod_perl and global %Live_Objects not being initialized

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

From: Perrin Harkins
Subject: Re: mod_perl and global %Live_Objects not being initialized
Date: 01:49 on 19 Nov 2004
On Tue, 2004-11-16 at 12:15, William McKee wrote:
> 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.

Sorry I'm a bit slow on this one guys; I was busy at ApacheCon.

William is correct, the behavior is intentional and it will never cause
problems unless you have references to these objects sticking around
somewhere in globals or closures.  I run Class::DBI in mod_perl all the
time and never have problems with this.

> > I think the problem comes from Class::DBI itself, by defining it as "my 
> > %Live_Objects;" but not initializing it.

It's done that way on purpose to make %Live_Objects into a closure
variable.  It is supposed to be persistent.  However, this could be
changed to a global with no bad effects.  I use closure vars rather than
globals when I'm coding unless I intend to expose the value to external
code.  Probably a good idea to do that in this case, for debugging
purposes.

> Hopefully Perrin will have some insight on initializing the
> %Live_Objects.

As stated above, it is not intended to be re-initialized on each
request.  It should last for the life of your program, regardless of
whether that program is mod_perl or a command-line script.

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

Just to be clear, there are no performance benefits from the
%Live_Objects index.  It's only reason for existence is to prevent
having two objects that represent the same database row in memory at
once.

- Perrin

(message missing)

Re: mod_perl and global %Live_Objects not being initialized
Perrin Harkins 01:49 on 19 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