note
tilly
Not true. On 5.005_03 try this:
<code>
my $foo = be({name => "foo"});
my $bar = be({name => "bar", data => $foo});
my $baz = be({name => "baz", data => $bar});
sub gotcha {
$bar->{"bar can't go"} = "until this function is cleaned up";
}
sub be {
return bless shift;
}
sub DESTROY {
my $self = shift;
print "$self->{name} died\n";
}
__END__
on 5.005_03 for me prints:
baz died
foo died
bar died
</code>
Note that $foo is going away <i>before</i> $bar. Remove the function holding $bar to global destruction and everything will clean up properly. Make them all global and you will again run into trouble.
103323
103628