Fellow Monks,
my Google-fu isn’t being too good to me today, so I might be asking something that’s been asked a million times before. Sorry about that.
I have an object, and for various reasons, I’d like to have a DESTROY sub sometimes, but sometimes not. This destructor kills some processes related to this object as a last-minute clean up, but in some situations this is something that wreaks havoc and hence the conditional. So I thought of passing another param to new() and if it’s set, I'd like to bail out from the DESTROY call (return if $self->{no_destroy}). But it turns out that this variable is no longer set by the time we arrive to the DESTROY sub.
Is there anything I could do?
UPDATE: It seems it was a typical brown paper bag-quality 8th layer error. See the reduced code example in response to Corion’s reply, it works just fine.
In reply to Conditional DESTROY by Ralesk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |