diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-10-28 23:56:01 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-10-30 12:36:04 -0700 |
commit | 62f099ef204889a21560e343bf620c0f18ca5249 (patch) | |
tree | df4ad41d0b093238b21873368d55a3f9e134dba9 /t/op/qr.t | |
parent | a896ab67104cb26016f7f3f97991d6e0720034d0 (diff) | |
download | perl-62f099ef204889a21560e343bf620c0f18ca5249.tar.gz |
Turn off OK flags when creating a regexp.
$ perl5.16.0 -le '$x = 1.1; $x = ${qr//}; print 0+$x'
4.15336878055219e-317
$ perl5.16.0 -le '$x = 1; $x = ${qr//}; print 0+$x'
1645024
Very strange.
Under debugging builds, both produce assertion failures.
By turning off all OK flags, we also prevent the destination’s utf8-
ness from sticking.
Diffstat (limited to 't/op/qr.t')
-rw-r--r-- | t/op/qr.t | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -7,7 +7,7 @@ BEGIN { require './test.pl'; } -plan(tests => 24); +plan(tests => 28); sub r { return qr/Good/; @@ -82,3 +82,17 @@ ok tied $t, 'tied var is still tied after regexp assignment'; bless \my $t2; $t2 = ${qr||}; is ref \$t2, 'main', 'regexp assignment is not maledictory'; + +{ + my $w; + local $SIG{__WARN__}=sub{$w=$_[0]}; + $_ = 1.1; + $_ = ${qr//}; + is 0+$_, 0, 'double upgraded to regexp'; + like $w, 'numeric', 'produces non-numeric warning'; + undef $w; + $_ = 1; + $_ = ${qr//}; + is 0+$_, 0, 'int upgraded to regexp'; + like $w, 'numeric', 'likewise produces non-numeric warning'; +} |