-
Notifications
You must be signed in to change notification settings - Fork 601
Closed
Description
Hello,
I'm not 100% sure if this is a bug, but this looks funny:
$ cat a.pl
sub x { qw(y)
=pod
=cut
}
$ perl -c a.pl
Can't modify constant item in scalar assignment at a.pl line 6, near "cut
}"
/home/dk/a.pl had compilation errors.
This is very ancient and I traced this back to e438e50 from 2005, and is basically this diff:
diff --git a/toke.c b/toke.c
index afa32a54a5..9d566385ef 100644
--- a/toke.c
+++ b/toke.c
@@ -4899,6 +4899,7 @@ Perl_yylex(pTHX)
s = scan_str(s,FALSE,FALSE);
if (!s)
missingterm((char*)0);
+ PL_expect = XOPERATOR;
force_next(')');
if (SvCUR(PL_lex_stuff)) {
OP *words = Nullop;
I've applied the modified version of this to the toke.c from blead, like this:
diff --git a/toke.c b/toke.c
index 650284657c..f4a7598b29 100644
--- a/toke.c
+++ b/toke.c
@@ -5813,7 +5813,7 @@ yyl_qw(pTHX_ char *s, STRLEN len)
s = S_scan_terminated(aTHX_ s, 0);
COPLINE_SET_FROM_MULTI_END;
- PL_expect = XOPERATOR;
+// PL_expect = XOPERATOR;
if (SvCUR(PL_lex_stuff)) {
int warned_comma = !ckWARN(WARN_QW);
int warned_comment = warned_comma;
and perl passed all tests.
I don't think I have the deep knowledge to decide whether that is a bug, a feature, or part of something bigger, but here's all the info you need if you would address that interesting behavior.
Regards,
Dmitry Karasik
Metadata
Metadata
Assignees
Labels
No labels