Change 34984 by [EMAIL PROTECTED] on 2008/12/02 20:16:33

        Codify the current behaviour of evals which define subroutines before
        failing (due to syntax errors).

Affected files ...

... //depot/perl/t/comp/retainedlines.t#5 edit

Differences ...

==== //depot/perl/t/comp/retainedlines.t#5 (text) ====
Index: perl/t/comp/retainedlines.t
--- perl/t/comp/retainedlines.t#4~34981~        2008-12-02 08:20:01.000000000 
-0800
+++ perl/t/comp/retainedlines.t 2008-12-02 12:16:33.000000000 -0800
@@ -10,7 +10,7 @@
 
 use strict;
 
-plan (tests => 55);
+plan (tests => 57);
 
 $^P = 0xA;
 
@@ -54,6 +54,27 @@
     $name++;
 }
 
+{
+  # This contains a syntax error
+  my $prog = "sub $name {
+    'This is $name'
+  }
+1 +
+";
+
+  eval $prog and die;
+
+  is (eval "$name()", "This is $name", "Subroutine was compiled, despite 
error")
+    or diag $@;
+
+  my @after = grep { /eval/ } keys %::;
+
+  is (@after, 0 + keys %seen,
+      "current behaviour is that errors in eval trump subroutine definitions");
+
+  $name++;
+}
+
 foreach my $flags (0x0, 0x800, 0x1000, 0x1800) {
     local $^P = $^P | $flags;
     # This is easier if we accept that the guts eval will add a trailing \n
End of Patch.

Reply via email to