Failures in DESTROY()
When code in a destructor threw an exception, it went unnoticed in ear-
lier versions of Perl, unless someone happened to be looking in $@ just
after the point the destructor happened to run. Such failures are now
visible as warnings when warnings are enabled.
####
$ perl -wle 'sub DESTROY { die "dead" }; { bless \my $o }'
(in cleanup) dead at -e line 1.
####
(in cleanup) %s
(W misc) This prefix usually indicates that a DESTROY() method
raised the indicated exception. Since destructors are usually
called by the system at arbitrary points during execution, and
often a vast number of times, the warning is issued only once for
any number of failures that would otherwise result in the same
message being repeated.
####
$ perl -wle 'sub DESTROY { die "dead" }; { bless \my $o; bless \my $p }'
(in cleanup) dead at -e line 1.
$ perl -wle 'sub DESTROY { die "dead: $_[0]"}; { bless \my $o; bless \my $p }'
(in cleanup) dead: main=SCALAR(0x805f0d4) at -e line 1.
(in cleanup) dead: main=SCALAR(0x805f164) at -e line 1.
####
$ perl -wle 'my $c=0; sub DESTROY { die "dead: ",$c++; }; { bless \my $o; bless \my $p }'
(in cleanup) dead: 0 at -e line 1.
(in cleanup) dead: 1 at -e line 1.