Avoid uninit warning for qq|${\<<FOO}|
authorFather Chrysostomos <sprout@cpan.org>
Wed, 29 Aug 2012 15:36:40 +0000 (08:36 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 31 Aug 2012 01:18:07 +0000 (18:18 -0700)
If a here-doc occurs inside a single-line quote-like operator inside
a file (as opposed to an eval), it produces an uninitialized warning.
The goto I added in commit 99bd9d90 wentto the wrong place.

t/op/heredoc.t
toke.c

index 0230d88..08b0af2 100644 (file)
@@ -7,7 +7,7 @@ BEGIN {
 }
 
 use strict;
-plan(tests => 8);
+plan(tests => 9);
 
 
 # heredoc without newline (#65838)
@@ -51,6 +51,12 @@ HEREDOC
         { switches => ['-X'] },
         "crlf-terminated heredoc"
     );
+    fresh_perl_is(
+        "print qq|\${\\<<foo}|\nick and queasy\nfoo\n",
+        'ick and queasy',
+        { switches => ['-w'], stderr => 1 },
+        'no warning for qq|${\<<foo}| in file'
+    );
 }
 
 
diff --git a/toke.c b/toke.c
index 665f977..0a74efe 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -9751,8 +9751,8 @@ S_scan_heredoc(pTHX_ register char *s)
        s = olds;
     }
     else
+      streaming:
        sv_setpvs(tmpstr,"");   /* avoid "uninitialized" warning */
-  streaming:
     term = PL_tokenbuf[1];
     len--;
     while (s >= PL_bufend) {   /* multiple line string? */