Re: data persistence problem with Class::DBI
[prev]
[thread]
[next]
[Date index for 2005/04/14]
On Thu, Apr 14, 2005 at 02:46:39PM -0400, Eric W. Bates wrote:
> We're using Class::DBI in a mod_perl context and all is working quite
> well. However, sometimes a CDBI object persists with old data after the
> record has been updated. Hitting apache with a 'graceful' fixes it.
>
> We have separate handlers for displaying and editing the records; so I'm
> assuming that the copy of the object used in the display handler is
> persisting between accesses in spite of the handler's code
> reinstantiating the object with a retrieve().
>
> Anybody dealt with this?
>
> Think it's a feature of Ima::DBI or some other part of Class::DBI?
Take a look at UNIQUENESS OF OBJECTS IN MEMORY in the Class:DBI manpage.
I had a very similar problem. In my case I think the object is
persisting because it is being accessed from a TT2 page and I suspect
TT2 is creating a closure, but I haven't tracked the reasons fully.
I fixed the problem with a call to clear_object_index at the start of
the handler. I'd be pleased to hear of a slightly more subtle approach
though.
--
Paul Johnson - paul@xxxx.xxx
http://www.pjcj.net
 |
 |
Re: data persistence problem with Class::DBI
Paul Johnson 19:02 on 14 Apr 2005
|