sub Foo::DESTROY { print "foo::DESTROY called\n"; } { my $x = do {my $var; bless sub {$var}, 'Foo'; }; } __END__ foo::DESTROY called
The fact that a simple sub { "test" } isn't garbage collected is an optimization that's poorly hidden from the user. It basically means that perl doesn't have to recompile a sub. Since eval can't be cached anyway it doesn't make sense to perform that optimization there.
In reply to Re: coderefs keep references to themselves
by moritz
in thread coderefs keep references to themselves
by jettero
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |