develooper Front page | perl.perl5.porters | Postings from October 2007

warning from ext/Hash/Util/FieldHash/t/02_function.t

Thread Next
From:
Dintelmann, Peter
Date:
October 24, 2007 03:31
Subject:
warning from ext/Hash/Util/FieldHash/t/02_function.t
Message ID:
3852726AFA94DE4F87E616F13F416A5FB66DE3@naimucu1.ffz00k.rootdom.net
When building a 64-bit perl on Solaris two warnings are issued
by "make test":

    ext/Hash/Util/FieldHash/t/01_load.............................ok
    ext/Hash/Util/FieldHash/t/02_function.........................
    Hexadecimal number > 0xffffffff non-portable at ../ext/Hash/Util
    /FieldHash/t/02_function.t line 318.
    Hexadecimal number > 0xffffffff non-portable at ../ext/Hash/Util
    /FieldHash/t/02_function.t line 125.
    ok
    ext/Hash/Util/FieldHash/t/03_class............................ok

The patch below tries to simply silence these warnings.

$ diff -urd 02_function.t 02_function.patch.t 
--- 02_function.t       2007-10-24 12:26:29.000000000 +0200
+++ 02_function.patch.t 2007-10-24 12:26:29.000000000 +0200
@@ -122,7 +122,7 @@
     $f{ $key} = $val;
     is( $f{ $key}, $val, "plain key set in field");
     my ( $id) = keys %f;
-    my $refaddr = hex +($key =~ /\(0x([[:xdigit:]]+)\)$/)[ 0];
+    my $refaddr = refaddr($key);
     is $id, $refaddr, "key is refaddr";
     bless $key;
     is( $f{ $key}, $val, "access through blessed");
@@ -314,6 +314,9 @@
 #######################################################################
 
 sub refaddr {
+    # silence possible warnings from hex() on 64bit systems
+    no warnings 'portable';
+ 
     my $ref = shift;
     hex +($ref =~ /\(0x([[:xdigit:]]+)\)$/)[ 0];
 }

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About