Subject: | Trampling of $@ with deeply nested try blocks |
In Error v0.15 (and presumably older versions) sometimes exception information is lost when very many nested try blocks are used and a non-object exception is thrown (eg from a syntax error or die rather than a throw). We are hitting this in our application of 50,000 lines of perl code. Object throws always work fine, the problem is with $@ being cleared as the stack unrolls and so the error message is simply thrown as " at line 273" without any associated text (the class knows there was an error but does not have any string). The attached patch localizes $@ before the try{}, and this fixes the problem.
Reproducable with perl 5.6.1 and perl5.8.1RC4 (linux rh7.3). I am as yet unable to reproduce this with a small amount of test code (I am working on that).
Tim
--- Error.pm.ori Tue Aug 19 15:59:37 2003
+++ Error.pm Tue Aug 19 16:00:00 2003
@@ -367,6 +367,7 @@
do {
local $Error::THROWN = undef;
+ local $@ = undef;
$ok = eval {
if($wantarray) {