This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
For #16249 - Overwrite PL_last_lop_op when eval() is called.
authorMatthew Horsfall (alh) <wolfsage@gmail.com>
Tue, 3 Jul 2012 05:20:39 +0000 (22:20 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 3 Jul 2012 05:40:28 +0000 (22:40 -0700)
Otherwise, parsing later on down the road may use the previous value, which, if it was OP_PRINT, causes the parser to fail

t/lib/warnings/toke
toke.c

index 2a34811..e436cec 100644 (file)
@@ -1272,3 +1272,10 @@ use warnings;
 CORE::렏;
 EXPECT
 CORE::렏 is not a keyword at - line 5.
+########
+# toke.c
+# [perl #16249]
+print '';
+eval this_method_is_fake ();
+EXPECT
+Undefined subroutine &main::this_method_is_fake called at - line 4.
diff --git a/toke.c b/toke.c
index 13d7ac2..d9963a9 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -297,6 +297,7 @@ static const char* const lex_state_names[] = {
        pl_yylval.ival = f; \
        PL_bufptr = s; \
        PL_last_uni = PL_oldbufptr; \
+       PL_last_lop_op = f; \
        if (*s == '(') \
            return REPORT( (int)FUNC1 ); \
        s = PEEKSPACE(s); \