diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2015-01-24 09:44:46 +0000 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2015-01-24 09:44:46 +0000 |
commit | d0500f096808fa409ac4682e66b531b365a56293 (patch) | |
tree | 0ff2be25ed3c1e1e0384c0fcdf6205788ceded7f | |
parent | 2b2266b19c5f9a3d80040e731c02927e6be1dace (diff) | |
download | perl-d0500f096808fa409ac4682e66b531b365a56293.tar.gz |
Update CPAN-Meta-Requirements to CPAN version 2.132
[DELTA]
2.132 2015-01-22 17:09:19-05:00 America/New_York
[FIXED]
- Precision of version requirement "0.00" is preserved when merging
requirements.
-rwxr-xr-x | Porting/Maintainers.pl | 2 | ||||
-rw-r--r-- | cpan/CPAN-Meta-Requirements/lib/CPAN/Meta/Requirements.pm | 8 | ||||
-rw-r--r-- | cpan/CPAN-Meta-Requirements/t/basic.t | 18 | ||||
-rw-r--r-- | cpan/CPAN-Meta-Requirements/t/strings.t | 15 |
4 files changed, 38 insertions, 5 deletions
diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index 0aa1a2f163..0fb3137296 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -294,7 +294,7 @@ use File::Glob qw(:case); }, 'CPAN::Meta::Requirements' => { - 'DISTRIBUTION' => 'DAGOLDEN/CPAN-Meta-Requirements-2.131.tar.gz', + 'DISTRIBUTION' => 'DAGOLDEN/CPAN-Meta-Requirements-2.132.tar.gz', 'FILES' => q[cpan/CPAN-Meta-Requirements], 'EXCLUDED' => [ qw(CONTRIBUTING.mkdn), diff --git a/cpan/CPAN-Meta-Requirements/lib/CPAN/Meta/Requirements.pm b/cpan/CPAN-Meta-Requirements/lib/CPAN/Meta/Requirements.pm index e86dd561d4..8348559498 100644 --- a/cpan/CPAN-Meta-Requirements/lib/CPAN/Meta/Requirements.pm +++ b/cpan/CPAN-Meta-Requirements/lib/CPAN/Meta/Requirements.pm @@ -3,7 +3,7 @@ use warnings; package CPAN::Meta::Requirements; # ABSTRACT: a set of version requirements for a CPAN dist -our $VERSION = '2.131'; +our $VERSION = '2.132'; #pod =head1 SYNOPSIS #pod @@ -119,7 +119,7 @@ sub _version_object { } eval { - if (not defined $version or $version eq '0') { + if (not defined $version or (!ref($version) && $version eq '0')) { $vobj = $V0; } elsif ( ref($version) eq 'version' || _isa_version($version) ) { @@ -229,7 +229,7 @@ BEGIN { sub add_minimum { my ($self, $name, $version) = @_; - if (not defined $version or $version eq '0') { + if (not defined $version or (!ref($version) && $version eq '0')) { return $self if $self->__entry_for($name); Carp::confess("can't add new requirements to finalized requirements") if $self->is_finalized; @@ -787,7 +787,7 @@ CPAN::Meta::Requirements - a set of version requirements for a CPAN dist =head1 VERSION -version 2.131 +version 2.132 =head1 SYNOPSIS diff --git a/cpan/CPAN-Meta-Requirements/t/basic.t b/cpan/CPAN-Meta-Requirements/t/basic.t index 882e32466e..ba029f427b 100644 --- a/cpan/CPAN-Meta-Requirements/t/basic.t +++ b/cpan/CPAN-Meta-Requirements/t/basic.t @@ -233,4 +233,22 @@ sub foo_1 { is ( $scalar, undef, "requirements_for_module() returns undef for not found (scalar)" ); } +{ + my $req = CPAN::Meta::Requirements->new; + + $req->add_minimum(Foo => "0.00"); + + my $req2 = CPAN::Meta::Requirements->new; + $req2->add_requirements($req); + + is_deeply( + $req2->as_string_hash, + { + Foo => '0.00' + }, + "0.00 precision preserved", + ); + +} + done_testing; diff --git a/cpan/CPAN-Meta-Requirements/t/strings.t b/cpan/CPAN-Meta-Requirements/t/strings.t index 94a52367a4..55a28bee6b 100644 --- a/cpan/CPAN-Meta-Requirements/t/strings.t +++ b/cpan/CPAN-Meta-Requirements/t/strings.t @@ -55,6 +55,21 @@ ok(!$req->accepts_module('A::Tribe::Called' => '1.2'), 'lower version (>=, <=, ! ok(!$req->accepts_module('A::Tribe::Called' => '2.1'), 'higher version (>=, <=, !)'); ok(!$req->accepts_module('A::Tribe::Called' => '1.6'), 'excluded version (>=, <=, !)'); +# Test precision +{ + my $req = CPAN::Meta::Requirements->new; + + $req->add_string_requirement(Foo => "0.00"); + + is_deeply( + $req->as_string_hash, + { + Foo => '0.00' + }, + "0.00 precision preserved", + ); +} + # Test fatal errors dies_ok { $req->add_string_requirement('Foo::Bar', "not really a version") } qr/Can't convert/, |