in reply to cleaning up in DESTROY
#!/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.
|
|---|