p4raw-id: //depot/perl@5660
I32 cxix;
register PERL_CONTEXT *cx;
bool popsub2 = FALSE;
+ bool clear_errsv = FALSE;
I32 gimme;
SV **newsp;
PMOP *newpm;
popsub2 = TRUE;
break;
case CXt_EVAL:
+ if (!(PL_in_eval & EVAL_KEEPERR))
+ clear_errsv = TRUE;
POPEVAL(cx);
if (CxTRYBLOCK(cx))
break;
LEAVE;
LEAVESUB(sv);
+ if (clear_errsv)
+ sv_setpv(ERRSV,"");
return pop_return();
}
#!./perl
-print "1..38\n";
+print "1..40\n";
eval 'print "ok 1\n";';
print $c eq '2222222222' ? "ok $x\n" : "# $c\nnot ok $x\n";
$x++;
}
+
+# return from eval {} should clear $@ correctly
+{
+ my $status = eval {
+ eval { die };
+ print "# eval { return } test\n";
+ return; # removing this changes behavior
+ };
+ print "not " if $@;
+ print "ok $x\n";
+ $x++;
+}
+
+# ditto for eval ""
+{
+ my $status = eval q{
+ eval q{ die };
+ print "# eval q{ return } test\n";
+ return; # removing this changes behavior
+ };
+ print "not " if $@;
+ print "ok $x\n";
+ $x++;
+}