in reply to Conditional DESTROY
This surprises me. $self and the hash referenced by it should always be valid, even when global destruction sets in. What might have gone already are objects referenced by %$self.
At least for plain hash-based objects, I don't know of failure cases like you describe. Can you please post a short example that (sometimes) exhibits the problem you describe? I understand that it is hard to reduce a large program where global destruction happens to a small example that condenses the problem to a few lines.
As a workaround, you can prevent your objects falling prey to global destructions by releasing them earlier, through strategically undeffing the referencing variables:
my $master= My::Master::Object->new(); ... undef $master; # release object tree before global destruction sets in # end of source code
If you already try to be clever and use Scalar::Util::weaken, maybe you are accessing a weakened reference somewhere, which has rightfully lost its grip onto the object data already?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Conditional DESTROY
by Ralesk (Pilgrim) on Jun 10, 2013 at 09:39 UTC | |
by Corion (Patriarch) on Jun 10, 2013 at 10:43 UTC | |
by Ralesk (Pilgrim) on Jun 10, 2013 at 10:54 UTC |