Keep It Simple, Stupid | |
PerlMonks |
Re: weaken CODEREFby Haarg (Priest) |
on Nov 11, 2013 at 09:59 UTC ( [id://1061969]=note: print w/replies, xml ) | Need Help?? |
Also, weaken is working properly on the coderef. You can see this by checking the ref counts using Devel::Peek. The ref count just never reaches 0 because perl itself is holding the last reference. Weakening a non-closure sub is also not particularly useful. Weakening is meant to be used to prevent memory leaks, but the existence of a non-closure sub can't cause memory leaks. perl has to have a reference to the compiled sub anyway, and without a closure you can't create reference loops.
In Section
Seekers of Perl Wisdom
|
|