summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pp_ctl.c5
-rwxr-xr-xt/op/range.t11
2 files changed, 15 insertions, 1 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 2f66a5ff8a..52fcf96016 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1069,6 +1069,11 @@ PP(pp_flop)
register SV *sv;
I32 max;
+ if (SvGMAGICAL(left))
+ mg_get(left);
+ if (SvGMAGICAL(right))
+ mg_get(right);
+
if (SvNIOKp(left) || !SvPOKp(left) ||
(looks_like_number(left) && *SvPVX(left) != '0') )
{
diff --git a/t/op/range.t b/t/op/range.t
index 01f5f70568..1698db4a55 100755
--- a/t/op/range.t
+++ b/t/op/range.t
@@ -1,6 +1,6 @@
#!./perl
-print "1..12\n";
+print "1..13\n";
print join(':',1..5) eq '1:2:3:4:5' ? "ok 1\n" : "not ok 1\n";
@@ -55,3 +55,12 @@ print "ok 11\n";
print "not " unless "@a" eq "-2147483647 -2147483646";
print "ok 12\n";
+# check magic
+{
+ my $bad = 0;
+ local $SIG{'__WARN__'} = sub { $bad = 1 };
+ my $x = 'a-e';
+ $x =~ s/(\w)-(\w)/join ':', $1 .. $2/e;
+ $bad = 1 unless $x eq 'a:b:c:d:e';
+ print $bad ? "not ok 13\n" : "ok 13\n";
+}