This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_leavesublv(): document PL_sv_undef exception
authorDavid Mitchell <davem@iabyn.com>
Mon, 14 Dec 2015 12:10:45 +0000 (12:10 +0000)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 09:18:34 +0000 (09:18 +0000)
pp_ctl.c

index b49f86d..cde30a4 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2401,6 +2401,12 @@ PP(pp_leavesublv)
                           ? *MARK
                           : sv_2mortal(SvREFCNT_inc_simple_NN(*MARK));
        else for (; MARK <= SP; MARK++) {
+            /* the PL_sv_undef exception is to allow things like this to
+             * work, where PL_sv_undef acts as 'skip' placeholder on the
+             * LHS of list assigns:
+             *    sub foo :lvalue { undef }
+             *    ($a, undef, foo(), $b) = 1..4;
+             */
            if (*MARK != &PL_sv_undef
                    && (SvPADTMP(*MARK) || SvREADONLY(*MARK))
            ) {