This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Test::Builder: Fix "return $a or $b" precedence issue
authorNiels Thykier <niels@thykier.net>
Mon, 15 Jul 2013 20:40:48 +0000 (22:40 +0200)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 15 Sep 2013 21:27:44 +0000 (14:27 -0700)
perl parses "return $a or $b" effectively as "return $a;", which is
not what was intended.

Signed-off-by: Niels Thykier <niels@thykier.net>
cpan/Test-Simple/lib/Test/Builder.pm

index cb4335f..729448c 100644 (file)
@@ -915,7 +915,7 @@ sub _is_dualvar {
 
     no warnings 'numeric';
     my $numval = $val + 0;
-    return $numval != 0 and $numval ne $val ? 1 : 0;
+    return ($numval != 0 and $numval ne $val ? 1 : 0);
 }
 
 =item B<is_eq>