Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: cleaning up in DESTROY

by mr_mischief (Monsignor)
on Apr 03, 2008 at 16:19 UTC ( [id://678199]=note: print w/replies, xml ) Need Help??


in reply to cleaning up in DESTROY

Here's a simple test case. Empirically, if you have this:

#!/usr/bin/perl -- use strict; use warnings; package Foo; sub new { my $self = { 'foo' => 'bar' }; return bless $self; } sub DESTROY { print $_[0]{'foo'} . "\n"; } package main; my $foo = Foo->new; exit;

then it produces this:

bar

So, as a rule I'd say yes it'll be there.

However, be sure to consider liz's comments in Re: cleaning up in DESTROY, the thread at Object reference disappearing during global destruction, and phillup's journal entry at http://use.perl.org/~phillup/journal/21827 which covers unordered global destruction as well. That appears to be a dark corner in which quite a few people find themselves. I don't think I'd call it a bug, per se, but maybe perlobj could be a little more verbose on the implications of what happens during global destruction.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://678199]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-18 23:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found