Subject: | part() output references input in XS, not in PP |
The XS version of part() appears to create scalars in its output by
making aliases to values in its input stream. Subsequent changes to
either the input or the output values, end up affecting the other. This
behavior is not present in the PP implementation. Here is sample output
from running the enclosed 'bug' program:
$ LIST_MOREUTILS_PP=1 ./bug
1 2
3 4
1 2
3 4
$ LIST_MOREUTILS_PP=0 ./bug
1 2
3 4
1 bogus
3 4
Here is the 'bug' program
#!/usr/bin/perl
use warnings;
use strict;
use List::MoreUtils qw(part);
my( $s1, $s2, $s3, $s4 ) = 1..4;
my $i=0;
my @array = part{ int( $i++ / 2 )} ( $s1, $s2, $s3, $s4 );
print "@{$_}\n" foreach @array;
print "\n";
$s2 = 'bogus';
print "@{$_}\n" foreach @array;
This is for
List::MoreUtils 0.33
perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux
Linux lxcvipal.cv.hp.com 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39
EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
Redhat-5 Enterprise Linux
Sorry, no patch.
Thanks -Paul
Subject: | bug |
Message body not shown because it is not plain text.