[OT] blessed sub-refs in the symbol table
David Cantrell
david at cantrell.org.uk
Thu Jan 31 11:12:30 GMT 2013
I am most disappointed to find that if you put a blessed sub-ref in the
symbol table and then replace it, its DESTROY method doesn't get called
straight away:
package Immortal;
sub new { return bless sub { print "called the object\n" }, shift; }
sub DESTROY { print "called DESTROY\n"; }
1;
$ perl -MImmortal -e '*Foo::bar = Immortal->new(); Foo::bar(); *Foo::bar = sub {print "blargh\n"}; Foo::bar();'
called the object
blargh
called DESTROY
looks like the blessed sub continues to exist right to the end of the
process, even though all references to it have gone away. Is this a bug?
--
David Cantrell | A machine for turning tea into grumpiness
comparative and superlative explained:
<Huhn> worse, worser, worsest, worsted, wasted
More information about the london.pm
mailing list