Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Enchant closures for better debugging output in Perl (effectiveperlprogramming.com)
31 points by rcfox on Sept 21, 2011 | hide | past | favorite | 2 comments


tl;dr; It is hard to debug by "print $abc;" when $abc is code reference. So you bless code reference with package providing stringification override to print out closure position (file, line) and "near" defined variables. Pretty useful!


Shouldn't you name your package CODE instead of "MagicalCoderef" so that ref returns the "right" value? :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: