diff options
author | Gerard Goossen <gerard@ggoossen.net> | 2009-12-27 17:24:28 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgs@consttype.org> | 2010-01-10 23:50:36 +0100 |
commit | 885ef6f56b61fd750ef3b1fa614d11480baac635 (patch) | |
tree | 2e5c91051dfa296a76e61c697e2a57e5669858db /op.c | |
parent | 3365b4123660b600293d3f9bd5054523f194b5b9 (diff) | |
download | perl-885ef6f56b61fd750ef3b1fa614d11480baac635.tar.gz |
Ignore a lvalue attribute after the subroutine has been defined, and warn about it. Fixes part of [perl #68758].
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -5714,7 +5714,9 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) )&& !attrs) { if (CvFLAGS(PL_compcv)) { /* might have had built-in attrs applied */ - CvFLAGS(cv) |= (CvFLAGS(PL_compcv) & CVf_BUILTIN_ATTRS); + if (CvLVALUE(PL_compcv) && ! CvLVALUE(cv)) + Perl_warner(aTHX_ packWARN(WARN_MISC), "lvalue attribute ignored after the subroutine has been defined"); + CvFLAGS(cv) |= (CvFLAGS(PL_compcv) & CVf_BUILTIN_ATTRS & ~CVf_LVALUE); } /* just a "sub foo;" when &foo is already defined */ SAVEFREESV(PL_compcv); |