in reply to coderefs keep references to themselves
As soon as you make the sub a closure (by referring to an external lexical var), it starts to behave the way you expect:
$ perl -e 'my $z; my $x = sub { $z; "test" }; bless $x, "HRM"; sub HR +M::DESTROY { print "bye\n" };' bye $
Dave.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: coderefs keep references to themselves
by jettero (Monsignor) on Jul 15, 2008 at 12:02 UTC | |
by Fletch (Bishop) on Jul 15, 2008 at 13:00 UTC |