From: John Peacock Date: Mon, 3 Feb 2014 12:48:57 +0000 (-0500) Subject: Sync bleadperl to version.pm 0.9908 X-Git-Tag: upstream/5.20.0~522 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d2b110e6a5467455bc4a3d333ec4f1abc5383bd8;p=platform%2Fupstream%2Fperl.git Sync bleadperl to version.pm 0.9908 Attached is a patch to bring blead up to date with the latest CPAN release of version.pm 0.9908. All tests pass (except the expected porting/customized.t). I'm hopeful that this will be the last update for a while. Thanks to Daniel Dragan for his insistent prodding to improve the code. ;-) Thanks John >From c501530aa386a3ccbdb35bcccbccd35d70315651 Mon Sep 17 00:00:00 2001 From: John Peacock Date: Sun, 2 Feb 2014 11:57:44 -0500 Subject: [PATCH] Update bleadperl to CPAN 0.9908 release Signed-off-by: Chris 'BinGOs' Williams --- diff --git a/cpan/version/lib/version.pm b/cpan/version/lib/version.pm index 280c859..b337a90 100644 --- a/cpan/version/lib/version.pm +++ b/cpan/version/lib/version.pm @@ -6,7 +6,7 @@ use strict; use vars qw(@ISA $VERSION $CLASS $STRICT $LAX *declare *qv); -$VERSION = 0.9907; +$VERSION = 0.9908; $CLASS = 'version'; # avoid using Exporter diff --git a/cpan/version/lib/version/regex.pm b/cpan/version/lib/version/regex.pm index 1c8f6e1..f92c78b 100644 --- a/cpan/version/lib/version/regex.pm +++ b/cpan/version/lib/version/regex.pm @@ -4,7 +4,7 @@ use strict; use vars qw($VERSION $CLASS $STRICT $LAX); -$VERSION = 0.9907; +$VERSION = 0.9908; #--------------------------------------------------------------------------# # Version regexp components diff --git a/cpan/version/lib/version/vpp.pm b/cpan/version/lib/version/vpp.pm index 3ef1170..3ac3f13 100644 --- a/cpan/version/lib/version/vpp.pm +++ b/cpan/version/lib/version/vpp.pm @@ -122,7 +122,7 @@ use strict; use Config; use vars qw($VERSION $CLASS @ISA $LAX $STRICT); -$VERSION = 0.9907; +$VERSION = 0.9908; $CLASS = 'version::vpp'; require version::regex; @@ -634,78 +634,78 @@ sub scan_version { return $s; } -sub new -{ - my ($class, $value) = @_; - unless (defined $class) { - require Carp; - Carp::croak('Usage: version::new(class, version)'); - } - my $self = bless ({}, ref ($class) || $class); - my $qv = FALSE; - - if ( ref($value) && eval('$value->isa("version")') ) { - # Can copy the elements directly - $self->{version} = [ @{$value->{version} } ]; - $self->{qv} = 1 if $value->{qv}; - $self->{alpha} = 1 if $value->{alpha}; - $self->{original} = ''.$value->{original}; - return $self; - } +sub new { + my $class = shift; + unless (defined $class or $#_ > 1) { + require Carp; + Carp::croak('Usage: version::new(class, version)'); + } - if ( not defined $value or $value =~ /^undef$/ ) { - # RT #19517 - special case for undef comparison - # or someone forgot to pass a value - push @{$self->{version}}, 0; - $self->{original} = "0"; - return ($self); - } + my $self = bless ({}, ref ($class) || $class); + my $qv = FALSE; - if ( $#_ == 2 ) { # must be CVS-style - $value = $_[2]; - $qv = TRUE; - } + if ( $#_ == 1 ) { # must be CVS-style + $qv = TRUE; + } + my $value = pop; # always going to be the last element - if (ref($value) =~ m/ARRAY|HASH/) { - require Carp; - Carp::croak("Invalid version format (non-numeric data)"); - } + if ( ref($value) && eval('$value->isa("version")') ) { + # Can copy the elements directly + $self->{version} = [ @{$value->{version} } ]; + $self->{qv} = 1 if $value->{qv}; + $self->{alpha} = 1 if $value->{alpha}; + $self->{original} = ''.$value->{original}; + return $self; + } + + if ( not defined $value or $value =~ /^undef$/ ) { + # RT #19517 - special case for undef comparison + # or someone forgot to pass a value + push @{$self->{version}}, 0; + $self->{original} = "0"; + return ($self); + } - $value = _un_vstring($value); - if ($Config{d_setlocale}) { - use POSIX qw/locale_h/; - use if $Config{d_setlocale}, 'locale'; - my $currlocale = setlocale(LC_ALL); + if (ref($value) =~ m/ARRAY|HASH/) { + require Carp; + Carp::croak("Invalid version format (non-numeric data)"); + } - # if the current locale uses commas for decimal points, we - # just replace commas with decimal places, rather than changing - # locales - if ( localeconv()->{decimal_point} eq ',' ) { - $value =~ tr/,/./; - } - } + $value = _un_vstring($value); - # exponential notation - if ( $value =~ /\d+.?\d*e[-+]?\d+/ ) { - $value = sprintf("%.9f",$value); - $value =~ s/(0+)$//; # trim trailing zeros + if ($Config{d_setlocale}) { + use POSIX qw/locale_h/; + use if $Config{d_setlocale}, 'locale'; + my $currlocale = setlocale(LC_ALL); + + # if the current locale uses commas for decimal points, we + # just replace commas with decimal places, rather than changing + # locales + if ( localeconv()->{decimal_point} eq ',' ) { + $value =~ tr/,/./; } + } - my $s = scan_version($value, \$self, $qv); + # exponential notation + if ( $value =~ /\d+.?\d*e[-+]?\d+/ ) { + $value = sprintf("%.9f",$value); + $value =~ s/(0+)$//; # trim trailing zeros + } - if ($s) { # must be something left over - warn("Version string '%s' contains invalid data; " - ."ignoring: '%s'", $value, $s); - } + my $s = scan_version($value, \$self, $qv); - return ($self); + if ($s) { # must be something left over + warn("Version string '%s' contains invalid data; " + ."ignoring: '%s'", $value, $s); + } + + return ($self); } *parse = \&new; -sub numify -{ +sub numify { my ($self) = @_; unless (_verify($self)) { require Carp; @@ -745,8 +745,7 @@ sub numify return $string; } -sub normal -{ +sub normal { my ($self) = @_; unless (_verify($self)) { require Carp; @@ -781,8 +780,7 @@ sub normal return $string; } -sub stringify -{ +sub stringify { my ($self) = @_; unless (_verify($self)) { require Carp; @@ -795,8 +793,7 @@ sub stringify : $self->numify; } -sub vcmp -{ +sub vcmp { require UNIVERSAL; my ($left,$right,$swap) = @_; my $class = ref($left); diff --git a/cpan/version/t/00impl-pp.t b/cpan/version/t/00impl-pp.t index 836a75a..ba540c9 100644 --- a/cpan/version/t/00impl-pp.t +++ b/cpan/version/t/00impl-pp.t @@ -9,7 +9,7 @@ use Test::More qw/no_plan/; BEGIN { (my $coretests = $0) =~ s'[^/]+\.t'coretests.pm'; require $coretests; - use_ok('version::vpp', 0.9907); + use_ok('version::vpp', 0.9908); } BaseTests("version::vpp","new","qv"); diff --git a/cpan/version/t/01base.t b/cpan/version/t/01base.t index 3c7edcf..b452e3b 100644 --- a/cpan/version/t/01base.t +++ b/cpan/version/t/01base.t @@ -9,7 +9,7 @@ use Test::More qw/no_plan/; BEGIN { (my $coretests = $0) =~ s'[^/]+\.t'coretests.pm'; require $coretests; - use_ok('version', 0.9907); + use_ok('version', 0.9908); } BaseTests("version","new","qv"); diff --git a/cpan/version/t/02derived.t b/cpan/version/t/02derived.t index 5bd4437..ee9e674 100644 --- a/cpan/version/t/02derived.t +++ b/cpan/version/t/02derived.t @@ -10,7 +10,7 @@ use File::Temp qw/tempfile/; BEGIN { (my $coretests = $0) =~ s'[^/]+\.t'coretests.pm'; require $coretests; - use_ok("version", 0.9907); + use_ok("version", 0.9908); # If we made it this far, we are ok. } diff --git a/cpan/version/t/03require.t b/cpan/version/t/03require.t index 48ddcd6..c394728 100644 --- a/cpan/version/t/03require.t +++ b/cpan/version/t/03require.t @@ -14,7 +14,7 @@ BEGIN { # Don't want to use, because we need to make sure that the import doesn't # fire just yet (some code does this to avoid importing qv() and delare()). require_ok("version"); -is $version::VERSION, 0.9907, "Make sure we have the correct class"; +is $version::VERSION, 0.9908, "Make sure we have the correct class"; ok(!"main"->can("qv"), "We don't have the imported qv()"); ok(!"main"->can("declare"), "We don't have the imported declare()"); diff --git a/cpan/version/t/05sigdie.t b/cpan/version/t/05sigdie.t index a145450..8b5b375 100644 --- a/cpan/version/t/05sigdie.t +++ b/cpan/version/t/05sigdie.t @@ -14,7 +14,7 @@ BEGIN { } BEGIN { - use version 0.9907; + use version 0.9908; } pass "Didn't get caught by the wrong DIE handler, which is a good thing"; diff --git a/cpan/version/t/06noop.t b/cpan/version/t/06noop.t index 97c7e65..66baef4 100644 --- a/cpan/version/t/06noop.t +++ b/cpan/version/t/06noop.t @@ -7,7 +7,7 @@ use Test::More qw/no_plan/; BEGIN { - use_ok('version', 0.9907); + use_ok('version', 0.9908); } my $v1 = version->new('1.2'); diff --git a/cpan/version/t/07locale.t b/cpan/version/t/07locale.t index de6588c..d852aec 100644 --- a/cpan/version/t/07locale.t +++ b/cpan/version/t/07locale.t @@ -11,7 +11,7 @@ use Test::More tests => 7; use Config; BEGIN { - use_ok('version', 0.9907); + use_ok('version', 0.9908); } SKIP: { @@ -31,7 +31,7 @@ SKIP: { # because have to # evaluate in current # scope - use locale; + use if $^O !~ /android/, 'locale'; while () { chomp; diff --git a/cpan/version/t/08_corelist.t b/cpan/version/t/08_corelist.t index 48c61c3..310c9cd 100644 --- a/cpan/version/t/08_corelist.t +++ b/cpan/version/t/08_corelist.t @@ -5,7 +5,7 @@ ######################### use Test::More tests => 3; -use_ok("version", 0.9907); +use_ok("version", 0.9908); # do strict lax tests in a sub to isolate a package to test importing SKIP: { diff --git a/cpan/version/t/09_list_util.t b/cpan/version/t/09_list_util.t index 110c1a0..d0e3fa9 100644 --- a/cpan/version/t/09_list_util.t +++ b/cpan/version/t/09_list_util.t @@ -4,7 +4,7 @@ ######################### use strict; -use_ok("version", 0.9907); +use_ok("version", 0.9908); use Test::More; BEGIN { diff --git a/vutil.c b/vutil.c index 96aa6f6..4cf0173 100644 --- a/vutil.c +++ b/vutil.c @@ -553,7 +553,9 @@ Perl_upg_version(pTHX_ SV *ver, bool qv) const MAGIC *mg; #endif +#if PERL_VERSION_LT(5,19,8) && defined(USE_ITHREADS) ENTER; +#endif PERL_ARGS_ASSERT_UPG_VERSION; if ( SvNOK(ver) && !( SvPOK(ver) && SvCUR(ver) == 3 ) ) @@ -656,7 +658,10 @@ Perl_upg_version(pTHX_ SV *ver, bool qv) Perl_ck_warner(aTHX_ packWARN(WARN_MISC), "Version string '%s' contains invalid data; " "ignoring: '%s'", version, s); + +#if PERL_VERSION_LT(5,19,8) && defined(USE_ITHREADS) LEAVE; +#endif return ver; }