Re: Let me adjust my question (was: A strange problem I have...)

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

From: Perrin Harkins
Subject: Re: Let me adjust my question (was: A strange problem I have...)
Date: 20:12 on 16 Dec 2004
On Thu, 2004-12-16 at 14:21 -0500, William McKee wrote:
> It seems like a function that could combine the undef and retrieve
> operations as well as update the object index would be useful. Since DBI
> must be subclassed, this function could be added to your subclass. This
> would provide another possible solution for people having troubles with
> objects staying in the index (albeit still a workaround for poorly
> written code).

Normally (when you don't have another copy of the object somewhere
else), this will work fine:

my $cd = Music::CD->retrieve(1);
undef $cd;
$cd = Music::CD->retrieve(1);

However, that will fail without the undef line in the middle, because
$cd will never go out of scope.

Your refresh() looks like it would be useful to some people, and it's
not the first time someone has asked how to do it.

> It'd be nice to be able to extract the package name from the object
> before undefining it

I think ref($obj) covers it.

> Also, I'm not sure whether calling remove_from_object_index on an object
> in a mod_perl environment would mean that the object never gets
> reindexed. From what I can tell of reading the code, the next retrieval
> should regenerate the object in the hash.

That's correct, it will be added to the index when it gets fetched
again.

- Perrin

(message missing)

Re: Let me adjust my question (was: A strange problem I have...)
Perrin Harkins 20:12 on 16 Dec 2004

Generated at 09:04 on 20 Dec 2004 by mariachi v0.52