Re: [perl #18114] [no subject] BUG: "-4\n".."0\n" is not DWIM
authorAbhijit Menon-Sen <ams@wiw.org>
Wed, 30 Oct 2002 22:30:32 +0000 (22:30 +0000)
committerAbhijit Menon-Sen <ams@wiw.org>
Wed, 30 Oct 2002 22:30:32 +0000 (22:30 +0000)
 but "-4\n".."-0\n" is!
From: Slaven Rezic <slaven.rezic@berlin.de>
Date: 30 Oct 2002 16:22:36 +0100
Message-Id: <87n0ow0x4z.fsf@vran.herceg.de>

Subject: RE: [perl #18114] [no subject] [TEST PATCH]BUG: "-4\n".."0\n"
 is not DWIM but "-4\n".."-0\n" is!
From: "Orton, Yves" <yves.orton@mciworldcom.de>
Date: Wed, 30 Oct 2002 11:59:31 -0000
Message-Id: <71B318898201D311845C0008C75DAD1C07B78BF7@defra1ex2>

(Applied over previous fix.)

p4raw-id: //depot/perl@18074

pp_ctl.c
t/op/range.t

index a482489..a91eb38 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -950,8 +950,7 @@ PP(pp_flop)
        if (SvNIOKp(left) || !SvPOKp(left) ||
            SvNIOKp(right) || !SvPOKp(right) ||
            (looks_like_number(left) && *SvPVX(left) != '0' &&
-            looks_like_number(right) && (*SvPVX(right) != '0' ||
-                                         SvCUR(right) == 1)))
+            looks_like_number(right)))
        {
            if (SvNV(left) < IV_MIN || SvNV(right) > IV_MAX)
                DIE(aTHX_ "Range iterator outside integer range");
index 862e64d..5200db2 100755 (executable)
@@ -75,5 +75,7 @@ for my $x ("0"..-1) {
 print "ok 15\n";
 
 # [#18165] Should allow "-4".."0", broken by #4730. (AMS 20021031)
-print "not " unless 5 == (() = "-4".."0");
-print "ok 16\n";
+print join(":","-4".."0")      eq "-4:-3:-2:-1:0" ? "ok 16\n" : "not ok 16\n";
+print join(":","-4".."-0")     eq "-4:-3:-2:-1:0" ? "ok 17\n" : "not ok 17\n";
+print join(":","-4\n".."0\n")  eq "-4:-3:-2:-1:0" ? "ok 18\n" : "not ok 18\n";
+print join(":","-4\n".."-0\n") eq "-4:-3:-2:-1:0" ? "ok 19\n" : "not ok 19\n";