From: Dave Mitchell Date: Thu, 2 Nov 2006 17:07:00 +0000 (+0000) Subject: eval $undef should emit one warning, not three. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0eb20fa22aa27beb10ebb64e033f5856e121ab29;p=p5sagit%2Fp5-mst-13.2.git eval $undef should emit one warning, not three. Also ensure that eval $undef clears $@ (it did, but only by luck) p4raw-id: //depot/perl@29193 --- diff --git a/pp_ctl.c b/pp_ctl.c index 708f2fa..7b91e86 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -3455,8 +3455,6 @@ PP(pp_entereval) } sv = POPs; - if (!SvPV_nolen_const(sv)) - RETPUSHUNDEF; TAINT_PROPER("eval"); ENTER; diff --git a/t/lib/warnings/9uninit b/t/lib/warnings/9uninit index 9b60808..f49ca66 100644 --- a/t/lib/warnings/9uninit +++ b/t/lib/warnings/9uninit @@ -1289,11 +1289,7 @@ $v = eval; $v = eval $m1; EXPECT Use of uninitialized value $_ in eval "string" at - line 4. -Use of uninitialized value $_ in eval "string" at - line 4. -Use of uninitialized value UTF8?'':'$_ 'in eval "string" at - line 4. -Use of uninitialized value $m1 in eval "string" at - line 5. Use of uninitialized value $m1 in eval "string" at - line 5. -Use of uninitialized value UTF8?'':'$m1 'in eval "string" at - line 5. ######## use warnings 'uninitialized'; my ($m1); diff --git a/toke.c b/toke.c index 4513c40..9b48f96 100644 --- a/toke.c +++ b/toke.c @@ -662,13 +662,11 @@ Perl_lex_start(pTHX_ SV *line) PL_lex_inwhat = 0; PL_sublex_info.sub_inwhat = 0; PL_linestr = line; - if (SvREADONLY(PL_linestr)) - PL_linestr = sv_2mortal(newSVsv(PL_linestr)); s = SvPV_const(PL_linestr, len); - if (!len || s[len-1] != ';') { - if (!(SvFLAGS(PL_linestr) & SVs_TEMP)) - PL_linestr = sv_2mortal(newSVsv(PL_linestr)); - sv_catpvs(PL_linestr, "\n;"); + if (SvREADONLY(PL_linestr) || !len || s[len-1] != ';') { + PL_linestr = sv_2mortal(len ? newSVsv(PL_linestr) : newSVpvn(s, 0)); + if (!len || s[len-1] != ';') + sv_catpvs(PL_linestr, "\n;"); } SvTEMP_off(PL_linestr); PL_oldoldbufptr = PL_oldbufptr = PL_bufptr = PL_linestart = SvPVX(PL_linestr);