develooper Front page | perl.perl5.porters | Postings from January 2001

[PATCH] Re: [ID 20001223.002] lvalues in list context

Thread Previous | Thread Next
From:
Radu Greab
Date:
January 6, 2001 17:25
Subject:
[PATCH] Re: [ID 20001223.002] lvalues in list context
Message ID:
14935.50580.376677.770684@ix.netsoft.ro
On Sat, 23 Dec 2000 19:59 GMT, root@dgreaves.com wrote:
 > 
 > This is a bug report for perl from david@dgreaves.com,
 > generated with the help of perlbug 1.28 running under perl v5.6.0.
 > 
 > 
 > -----------------------------------------------------------------
 > [Please enter your report here]
 > The behaviour I get using lvalues in a list is unexpected.

Patch below, against bleadperl.


Radu Greab


--- op.c~	Fri Jan  5 08:44:57 2001
+++ op.c	Sun Jan  7 03:07:22 2001
@@ -1391,6 +1391,7 @@
 	}
 	else {				/* lvalue subroutine call */
 	    o->op_private |= OPpLVAL_INTRO;
+	    PL_modcount++;
 	    if (type == OP_GREPSTART || type == OP_ENTERSUB || type == OP_REFGEN) {
 		/* Backward compatibility mode: */
 		o->op_private |= OPpENTERSUB_INARGS;
--- t/op/split.t~	Sat Dec 30 19:21:28 2000
+++ t/op/split.t	Sun Jan  7 03:17:48 2001
@@ -1,6 +1,6 @@
 #!./perl
 
-print "1..30\n";
+print "1..31\n";
 
 $FS = ':';
 
@@ -132,3 +132,11 @@
 @ary = map {ord} split //, v1.20.300.4000.50000.4000.300.20.1;
 print "not " unless "@ary" eq "1 20 300 4000 50000 4000 300 20 1";
 print "ok 30\n";
+
+# Bug 20001223.002: split thought that the list had only one element
+@ary = qw(4 5 6);
+sub lval1 : lvalue { $ary[0]; }
+sub lval2 : lvalue { $ary[1]; }
+(lval1(), lval2()) = split ' ', "1 2 3 4";
+print "not " unless join(':', @ary) eq "1:2:6";
+print "ok 31\n";

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About