develooper Front page | perl.perl5.porters | Postings from May 2003

Re: [cpan #2629] Wrong assumption in numeric comparison

From:
Dan Kogai
Date:
May 22, 2003 02:47
Subject:
Re: [cpan #2629] Wrong assumption in numeric comparison
Message ID:
49E36875-8C3A-11D7-9C91-000393AE4244@dan.co.jp

On Thursday, May 22, 2003, at 06:30  PM, via RT wrote:

>
> This message about Encode was sent to you by MAREKR <MAREKR@cpan.org> 
> via rt.cpan.org
>
> Full context and any attached attachments can be found at:
> <URL: https://rt.cpan.org/Ticket/Display.html?id=2629 >
>
> On my perl-5.8.0 (ithreads, shared libperl) on Solaris/Sparc 2.7
> I see the following warning in the test (Encode-1.95!!!):
>
> t/enc_utf8.......Argument "" isn't numeric in numeric eq (==) at 
> /home/hwadm/.cpan/build/Encode-1.95/blib/lib/encoding.pm line 30.
>
> This is because $Config{perl_patchevel} yields '' rather than 0.
> This should be changed, e.g. like this:
>   $Config{perl_patchlevel} ? ... : ...
> as '' and 0 are equally "false".
>
> Regards,
>
> Marek

Thanks for the report.  The patch below should fix it.

Dan the Encode Maintainer

===================================================================
RCS file: encoding.pm,v
retrieving revision 1.44
diff -u -r1.44 encoding.pm
--- encoding.pm 2003/03/09 20:07:37     1.44
+++ encoding.pm 2003/05/22 09:45:16
@@ -1,4 +1,4 @@
-# $Id: encoding.pm,v 1.44 2003/03/09 20:07:37 dankogai Exp dankogai $
+# $Id: encoding.pm,v 1.44 2003/03/09 20:07:37 dankogai Exp $
  package encoding;
  our $VERSION = do { my @r = (q$Revision: 1.44 $ =~ /\d+/g); sprintf 
"%d."."%02d" x $#r, @r };

@@ -27,7 +27,7 @@
            UTF-32 UTF-32BE UTF-32LE);
      $utfs{$name} or return 0;            # UTFs or no
      require Config; Config->import(); our %Config;
-    return $Config{perl_patchlevel} == 0 # maintperl then no
+    return $Config{perl_patchlevel} ? 0 : 1 # maintperl then no
  }

  sub import {




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