Perrin Harkins wrote: > > We've actually discussed this on the list. It has to do with closures. > Matt gave a presentation about exception handling which covers it and > shows a workaround. You can see it here: > > http://axkit.org/docs/presentations/tpc2001/
Sorry to chime in a little late on this. But the "Exceptions" slides from the page above are either misleading, or I am misunderstainding just what exactly leaks in Error. The slides above show a "BAD" example of Error.pm as: sub handler { my $r = shift; my $count; try { # use $count in here... } catch Error with { }; } However, the eToys article doesnt say that this is unsafe. What the eToys article says is unsafe is code with nested try blocks like this: my $count; try { ... try { # use $count in *here* }; }; in other words, if I understand the eToys article correctly, the leaks only happen if I nest a try block inside another try block. I have experimented some, and it appears to me that this is in fact the case ($count doesnt get cleaned up if there is a nested try). But as long as I dont nest try blocks there doesnt appear to be a leak. Are Matt's slides misleading on this point? Or am I missing something here? Mike