On Sun, Feb 20, 2011 at 02:30:47PM -0700, Tom Christiansen wrote:
> I can't figure out whether I've found a bug, or whether I'm being dense.
I think its a bug. Shorter example:
use feature ':5.10';
my $s = "abc";
for my $i (1..3) {
given ($s) {
/./gc or die;
printf "given: pos=%d\n", pos;
}
}
for my $i (1..3) {
do { my $_ = $s;
/./gc or die;
printf "do: pos=%d\n", pos;
}
}
outputs:
given: pos=1
given: pos=2
given: pos=3
do: pos=1
do: pos=1
do: pos=1
Given that C<given(x)> is documented to be equivalent to C<do { my $_ = x;>,
that smells like a bug to me. Unless anyone can come up with a rationale
of why this might be useful behaviour (which I doubt).
The problem is in pp_enterwhile(), which does
sv_setsv(PAD_SV(PL_op->op_targ), POPs);
which doesn't call set magic.
--
The Enterprise is involved in a bizarre time-warp experience which is in
some way unconnected with the Late 20th Century.
-- Things That Never Happen in "Star Trek" #14
Thread Previous
|
Thread Next