734417
From a3ff80c12c16886edf9acdd3d172798e50defdb3 Mon Sep 17 00:00:00 2001
734417
From: Eric Brine <ikegami@adaelis.com>
734417
Date: Mon, 18 Jun 2012 14:56:32 -0400
734417
Subject: [PATCH] RT#113730 - $@ should be cleared on "do" IO error.
734417
734417
---
734417
 pp_ctl.c  |  1 +
734417
 t/op/do.t | 12 ++++++++++++
734417
 2 files changed, 13 insertions(+)
734417
734417
diff --git a/pp_ctl.c b/pp_ctl.c
734417
index b414e81..437bc8f 100644
734417
--- a/pp_ctl.c
734417
+++ b/pp_ctl.c
734417
@@ -3928,6 +3928,7 @@ PP(pp_require)
734417
 	    DIE(aTHX_ "Can't locate %s", name);
734417
 	}
734417
 
734417
+	CLEAR_ERRSV();
734417
 	RETPUSHUNDEF;
734417
     }
734417
     else
734417
diff --git a/t/op/do.t b/t/op/do.t
734417
index 93d3f73..c5a5905 100644
734417
--- a/t/op/do.t
734417
+++ b/t/op/do.t
734417
@@ -286,4 +286,16 @@ SKIP: {
734417
   is($w, undef, 'do STRING does not propagate warning hints');
734417
 }
734417
 
734417
+# RT#113730 - $@ should be cleared on IO error.
734417
+{
734417
+    $@ = "should not see";
734417
+    $! = 0;
734417
+    my $rv = do("some nonexistent file");
734417
+    my $saved_error = $@;
734417
+    my $saved_errno = $!;
734417
+    ok(!$rv,          "do returns false on io errror");
734417
+    ok(!$saved_error, "\$\@ not set on io error");
734417
+    ok($saved_errno,  "\$! set on io error");
734417
+}
734417
+
734417
 done_testing();
734417
-- 
734417
1.7.11.4
734417