Re: Deleting an object on the other side of a has_a

[prev] [thread] [next] [Date index for 2004/09/01]

From: Perrin Harkins
Subject: Re: Deleting an object on the other side of a has_a
Date: 16:42 on 01 Sep 2004
On Wed, 2004-09-01 at 12:28, William McKee wrote:
> Seeing as you just opened my eyes regarding in-memory copies, I suspect
> that's where my problems have been.

I was actually referring to having the same object in memory in multiple
processes.  This is different from having scoping problems.

> What's the appropriate solution when
> you find this problems? Undef the original object and reload it?

The best solution is to track down why you still have a copy of
something that you thought went out of scope and fix the scoping
problem.  It's very rare to need to explicitly undef things.  One
example would be this:

sub example {
    my $foo = Foo->retrieve(1);
    # run some sub that might update that row elsewhere
    side_effects_sub();
    $foo = Foo->retrieve(1);
}

This won't work unless you undef $foo or call
$foo->remove_from_object_index(), because the second retrieve will just
fetch the $foo that is already in memory.

- Perrin

(message missing)

Deleting an object on the other side of a has_a
Peter Pimley 10:02 on 01 Sep 2004

Re: Deleting an object on the other side of a has_a
Perrin Harkins 16:09 on 01 Sep 2004

Re: Deleting an object on the other side of a has_a
Perrin Harkins 15:32 on 01 Sep 2004

Re: Deleting an object on the other side of a has_a
Perrin Harkins 16:33 on 01 Sep 2004

Re: Deleting an object on the other side of a has_a
Perrin Harkins 17:03 on 01 Sep 2004

Re: Deleting an object on the other side of a has_a
Perrin Harkins 16:42 on 01 Sep 2004

Re: Deleting an object on the other side of a has_a
Perrin Harkins 15:06 on 02 Sep 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52