+ if (CxLVAL(cx) && !ref) { /* Leave it as it is if we can. */
+ SV *sv;
+ if (MARK < SP) {
+ assert(MARK+1 == SP);
+ if ((SvPADTMP(TOPs) ||
+ (SvFLAGS(TOPs) & (SVf_READONLY | SVf_FAKE))
+ == SVf_READONLY
+ ) &&
+ !SvSMAGICAL(TOPs)) {
+ LEAVE;
+ cxstack_ix--;
+ POPSUB(cx,sv);
+ PL_curpm = newpm;
+ LEAVESUB(sv);
+ Perl_croak(aTHX_
+ "Can't return %s from lvalue subroutine",
+ SvREADONLY(TOPs) ? (TOPs == &PL_sv_undef) ? "undef"
+ : "a readonly value" : "a temporary");
+ }
+ else { /* Can be a localized value
+ EXTEND_MORTAL(1); * subject to deletion. */
+ PL_tmps_stack[++PL_tmps_ix] = *SP;
+ SvREFCNT_inc_void(*SP);
+ *++newsp = *SP;
+ }
+ }
+ else {
+ /* sub:lvalue{} will take us here. */
+ LEAVE;
+ cxstack_ix--;
+ POPSUB(cx,sv);
+ PL_curpm = newpm;
+ LEAVESUB(sv);
+ Perl_croak(aTHX_
+ /* diag_listed_as: Can't return %s from lvalue subroutine*/
+ "Can't return undef from lvalue subroutine"
+ );
+ }
+ }
+ else if (MARK < SP) {