diff options
author | Abhijit Menon-Sen <ams@wiw.org> | 2001-06-17 18:34:46 +0530 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-21 12:30:57 +0000 |
commit | f206cdda513dcda39e1ced147a33b8497001ef8b (patch) | |
tree | 88e24c87044ac3c26734865c4fb8c1485c7c751b /pp_hot.c | |
parent | c00330f1da4c399b60290728912d273d8459ad00 (diff) | |
download | perl-f206cdda513dcda39e1ced147a33b8497001ef8b.tar.gz |
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
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -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. */ |