in reply to Re: Conditional DESTROY
in thread Conditional DESTROY
Reduced the code, something is truly messing with me, because this thing runs perfectly:
package Foo; sub new { my ($class, $params) = @_; my $self = {}; $self->{no_DESTROY} = $params->{no_DESTROY} // 0; bless($self, $class); return $self; } sub DESTROY { my $self = shift; print "in DESTROY, no_DESTROY is $self->{no_DESTROY}\n"; return if $self->{no_DESTROY}; print "DESTROY body is running!\n"; } package main; my $foo = Foo->new({ no_DESTROY => 1 });
Argh. I messed with this most of Friday and it wouldn’t budge, now the mock-up code Just Works (as actually expected, too).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Conditional DESTROY
by Corion (Patriarch) on Jun 10, 2013 at 10:43 UTC | |
by Ralesk (Pilgrim) on Jun 10, 2013 at 10:54 UTC |