On Sun, Aug 21, 2005 at 01:00:07AM -0700, Yitzchak Scott-Thoennes wrote: > > IIRC (don't have time to check the code now), magic only results in > the private flags being set (e.g. SvIOKp), so it all Just Works (TM).
Ah, thanks. I could have sworn that I saw IOK with Devel::Peek in my preliminary tests but I must have been seeing things since I can't reproduce now. The problem is, as you stated, a missing mg_get. Patch included. -- Rick Delaney [EMAIL PROTECTED] diff -rpuN perl-current/pp_ctl.c perl-current-dev/pp_ctl.c --- perl-current/pp_ctl.c 2005-08-07 06:39:09.000000000 -0400 +++ perl-current-dev/pp_ctl.c 2005-08-21 14:52:48.145320881 -0400 @@ -1843,6 +1843,8 @@ PP(pp_enteriter) if (SvTYPE(cx->blk_loop.iterary) != SVt_PVAV) { dPOPss; SV *right = (SV*)cx->blk_loop.iterary; + SvGETMAGIC(sv); + SvGETMAGIC(right); if (RANGE_IS_NUMERIC(sv,right)) { if ((SvOK(sv) && SvNV(sv) < IV_MIN) || (SvOK(right) && SvNV(right) >= IV_MAX)) diff -rpuN perl-current/t/op/range.t perl-current-dev/t/op/range.t --- perl-current/t/op/range.t 2004-03-18 15:53:32.000000000 -0500 +++ perl-current-dev/t/op/range.t 2005-08-21 14:21:37.127953275 -0400 @@ -7,7 +7,7 @@ BEGIN { use Config; -print "1..37\n"; +print "1..45\n"; print join(':',1..5) eq '1:2:3:4:5' ? "ok 1\n" : "not ok 1\n"; @@ -140,3 +140,51 @@ print join(":", map "[$_]", @foo) eq '' @foo=(); push @foo, $_ for undef..undef; print join(":", map "[$_]", @foo) eq '[]' ? "ok 37\n" : "not ok 37\n"; + +# again with magic +{ + my @a = (1..3); + @foo=(); push @foo, $_ for undef..$#a; + print join(":", @foo) eq '0:1:2' ? "ok 38\n" : "not ok 38\n"; +} +{ + my @a = (); + @foo=(); push @foo, $_ for $#a..undef; + print join(":", @foo) eq '-1:0' ? "ok 39\n" : "not ok 39\n"; +} +{ + local $1; + "2" =~ /(.+)/; + @foo=(); push @foo, $_ for undef..$1; + print join(":", @foo) eq '0:1:2' ? "ok 40\n" : "not ok 40\n"; +} +{ + local $1; + "-2" =~ /(.+)/; + @foo=(); push @foo, $_ for $1..undef; + print join(":", @foo) eq '-2:-1:0' ? "ok 41\n" : "not ok 41\n"; +} +{ + local $1; + "B" =~ /(.+)/; + @foo=(); push @foo, $_ for undef..$1; + print join(":", map "[$_]", @foo) eq '[]' ? "ok 42\n" : "not ok 42\n"; +} +{ + local $1; + "B" =~ /(.+)/; + @foo=(); push @foo, $_ for ""..$1; + print join(":", map "[$_]", @foo) eq '[]' ? "ok 43\n" : "not ok 43\n"; +} +{ + local $1; + "B" =~ /(.+)/; + @foo=(); push @foo, $_ for $1..undef; + print join(":", map "[$_]", @foo) eq '' ? "ok 44\n" : "not ok 44\n"; +} +{ + local $1; + "B" =~ /(.+)/; + @foo=(); push @foo, $_ for $1..""; + print join(":", map "[$_]", @foo) eq '' ? "ok 45\n" : "not ok 45\n"; +}