From: Rafael Garcia-Suarez Date: Thu, 2 Sep 2004 15:01:39 +0000 (+0000) Subject: Upgrade to version 0.42. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c76df65ea1362504976e117978fbad4e35fdbb7e;p=p5sagit%2Fp5-mst-13.2.git Upgrade to version 0.42. From: Subject: CPAN Upload: J/JP/JPEACOCK/version-0.42.tar.gz From: John Peacock Date: Wed, 18 Aug 2004 08:26:35 -0400 Message-ID: <41234AFB.1020009@rowman.com> p4raw-id: //depot/perl@23257 --- diff --git a/lib/version.pm b/lib/version.pm index 3969544..0c888cd 100644 --- a/lib/version.pm +++ b/lib/version.pm @@ -12,7 +12,7 @@ use vars qw(@ISA $VERSION $CLASS @EXPORT); @EXPORT = qw(qv); -$VERSION = 0.41; # stop using CVS and switch to subversion +$VERSION = 0.42; # stop using CVS and switch to subversion $CLASS = 'version'; diff --git a/lib/version.t b/lib/version.t index b9dbf04..8636a3f 100644 --- a/lib/version.t +++ b/lib/version.t @@ -48,7 +48,7 @@ sub BaseTests { # Test quoted number processing diag "tests with quoted numbers" unless $ENV{PERL_CORE}; $version = $CLASS->new("5.005_03"); - is ( "$version" , "5.5_30" , '"5.005_03" eq "5.5_30"' ); + is ( "$version" , "5.005_030" , '"5.005_03" eq "5.005_030"' ); $version = $CLASS->new("v1.23"); is ( "$version" , "1.23.0" , '"v1.23" eq "1.23.0"' ); diff --git a/util.c b/util.c index cd28c19..396a40c 100644 --- a/util.c +++ b/util.c @@ -3934,7 +3934,7 @@ Perl_scan_version(pTHX_ char *s, SV *rv, bool qv) * floating point number, i.e. not quoted in any way */ if ( !qv && s > start+1 && saw_period == 1 ) { - mult *= 100; + mult *= 100; while ( s < end ) { orev = rev; rev += (*s - '0') * mult; @@ -3983,7 +3983,7 @@ Perl_scan_version(pTHX_ char *s, SV *rv, bool qv) */ len = 2 - len; while (len-- > 0) - av_push((AV *)sv, newSViv(0)); + av_push((AV *)sv, newSViv(0)); } return s; } @@ -4117,10 +4117,11 @@ Perl_vnumify(pTHX_ SV *vs) if ( len > 0 ) { digit = SvIVX(*av_fetch((AV *)vs, len, 0)); - - /* Don't display any additional trailing zeros */ if ( (int)PERL_ABS(digit) != 0 || len == 1 ) { + if ( digit < 0 ) /* alpha version */ + Perl_sv_catpv(aTHX_ sv,"_"); + /* Don't display additional trailing zeros */ Perl_sv_catpvf(aTHX_ sv,"%03d", (int)PERL_ABS(digit)); } } @@ -4191,12 +4192,13 @@ the original version contained 1 or more dots, respectively SV * Perl_vstringify(pTHX_ SV *vs) { - I32 len; + I32 len, digit; if ( SvROK(vs) ) vs = SvRV(vs); len = av_len((AV *)vs); + digit = SvIVX(*av_fetch((AV *)vs, len, 0)); - if ( len < 2 ) + if ( len < 2 || ( len == 2 && digit < 0 ) ) return vnumify(vs); else return vnormal(vs);