From: Abhijit Menon-Sen Date: Sun, 17 Jun 2001 13:04:46 +0000 (+0530) Subject: Re: Opinion on undef lvalue X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f206cdda513dcda39e1ced147a33b8497001ef8b;p=p5sagit%2Fp5-mst-13.2.git Re: Opinion on undef lvalue Message-ID: <20010617130446.B27925@lustre.linux.in> Allow lvalue subs to return undef in array context. p4raw-id: //depot/perl@10777 --- diff --git a/pp_hot.c b/pp_hot.c index 5d43a79..d5da0ae 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -2315,18 +2315,16 @@ PP(pp_leavesublv) else if (gimme == G_ARRAY) { EXTEND_MORTAL(SP - newsp); for (mark = newsp + 1; mark <= SP; mark++) { - if (SvFLAGS(*mark) & (SVs_TEMP | SVs_PADTMP | SVf_READONLY)) { + if (*mark != &PL_sv_undef + && SvFLAGS(*mark) & (SVs_TEMP | SVs_PADTMP | SVf_READONLY)) { /* Might be flattened array after $#array = */ PUTBACK; POPSUB(cx,sv); PL_curpm = newpm; LEAVE; LEAVESUB(sv); - DIE(aTHX_ "Can't return %s from lvalue subroutine", - (*mark != &PL_sv_undef) - ? (SvREADONLY(TOPs) - ? "a readonly value" : "a temporary") - : "an uninitialized value"); + DIE(aTHX_ "Can't return a %s from lvalue subroutine", + SvREADONLY(TOPs) ? "readonly value" : "temporary"); } else { /* Can be a localized value subject to deletion. */