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

[PATCH] Maintperl - version numbers mishandled

Thread Next
From:
Ian Phillipps
Date:
April 14, 2003 05:58
Subject:
[PATCH] Maintperl - version numbers mishandled
Message ID:
20030414104329.A16601@bob.tarragon-et.co.uk
[Apologies if this is a duplicate; I don't think the mail made it off my
cygwin setup, which is where this emerged].

There is a practice of writing things like $VERSION = "1.23_45"
However, this results in a value of $VERSION which is *not* a legal Perl
number.

A warning will be generated on any arithmetical operation - and several
warnings result during "make test" on maintperl from the problem patched
below.  If the number is used regardless, it will be treated as 1.23 -
not the number the writer evidently intended.

I've patched the format of the version number below, since a numerical
comparison is wanted. IT would be possible to say
	if( eval($VERSION) > 1.2344 )
which IMHO is ugly.

However, this is a more general problem, since maintperl contains a
number of examples of this error:

ext/Errno/Errno.pm:$VERSION = "1.09_00";
ext/Errno/Errno_pm.PL:our $VERSION = "1.09_00";
ext/IO/lib/IO/Dir.pm:$VERSION = "1.03_00";
ext/IO/lib/IO/Handle.pm:$VERSION = "1.21_00";
ext/IO/lib/IO/Seekable.pm:$VERSION = "1.08_00";
ext/IO/lib/IO/Socket/UNIX.pm:$VERSION = "1.20_00";
ext/IPC/SysV/Msg.pm:$VERSION = "1.00_00";
ext/IPC/SysV/Semaphore.pm:$VERSION = "1.00_00";
ext/IPC/SysV/SysV.pm:$VERSION = "1.03_00";
ext/List/Util/lib/List/Util.pm:our $VERSION    = "1.11_00";
lib/Errno.pm:$VERSION = "1.09_00";
lib/IO/Dir.pm:$VERSION = "1.03_00";
lib/IO/Handle.pm:$VERSION = "1.21_00";
lib/IO/Seekable.pm:$VERSION = "1.08_00";
lib/IO/Socket/UNIX.pm:$VERSION = "1.20_00";
lib/List/Util.pm:our $VERSION    = "1.11_00";
pod/perlmodstyle.pod:  $VERSION = "1.12_01";

I'm not offering patches for all these, pending a debate on the right
thing to do.

Ian

--- patch to suppress warnings during 'make test' on maintperl:

--- lib/Test/Harness.pm.orig	2003-03-31 12:52:31.000000000 +0100
+++ lib/Test/Harness.pm	2003-04-10 13:33:02.000000000 +0100
@@ -23,5 +23,5 @@
 $Have_Devel_Corestack = 0;
 
-$VERSION = '2.27_02';
+$VERSION = 2.27_02;
 
 $ENV{HARNESS_ACTIVE} = 1;

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