diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-08-17 14:45:29 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-08-17 16:45:22 -0700 |
commit | 4a7239ff0b409a13fa6982413ce503f8e5fa07c3 (patch) | |
tree | 6edbd2c43d1c1c6409cd2dc18dce338530f05cba | |
parent | 7c93c29bad5a630df394ef899b8f995cc29154c8 (diff) | |
download | perl-4a7239ff0b409a13fa6982413ce503f8e5fa07c3.tar.gz |
[perl #114040] Allow pod in quoted constructs
When the case = in toke.c:yylex is reached and PL_lex_state is
not LEX_NORMAL, that means we are in some sort of quoted construct,
and the entire construct’s content is in the current line buffer
(which, consequently contains more than one line). So we need to check
that when encountering pod. Quoted constructs need to be treated the
same way as string eval, which also puts all the code in the line
buffer.
-rw-r--r-- | t/comp/parser.t | 21 | ||||
-rw-r--r-- | toke.c | 3 |
2 files changed, 22 insertions, 2 deletions
diff --git a/t/comp/parser.t b/t/comp/parser.t index d22e9b3875..09f2d1c8bd 100644 --- a/t/comp/parser.t +++ b/t/comp/parser.t @@ -3,7 +3,7 @@ # Checks if the parser behaves correctly in edge cases # (including weird syntax errors) -print "1..139\n"; +print "1..140\n"; sub failed { my ($got, $expected, $name) = @_; @@ -397,6 +397,25 @@ $_ write }).*/; +eval ' +"${; + +=pod + +=cut + +}"; +'; +is $@, "", 'pod inside string in string eval'; +"${; + +=pod + +=cut + +}"; +print "ok ", ++$test, " - pod inside string outside of string eval\n"; + sub 'Hello'_he_said (_); is prototype "Hello::_he_said", '_', 'initial tick in sub declaration'; @@ -6001,7 +6001,8 @@ Perl_yylex(pTHX) if (PL_expect == XSTATE && isALPHA(tmp) && (s == PL_linestart+1 || s[-2] == '\n') ) { - if (PL_in_eval && !PL_rsfp && !PL_parser->filtered) { + if ((PL_in_eval && !PL_rsfp && !PL_parser->filtered) + || PL_lex_state != LEX_NORMAL) { d = PL_bufend; while (s < d) { if (*s++ == '\n') { |