In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/d0500f096808fa409ac4682e66b531b365a56293?hp=2b2266b19c5f9a3d80040e731c02927e6be1dace>
- Log ----------------------------------------------------------------- commit d0500f096808fa409ac4682e66b531b365a56293 Author: Chris 'BinGOs' Williams <[email protected]> Date: Sat Jan 24 09:44:46 2015 +0000 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. ----------------------------------------------------------------------- Summary of changes: Porting/Maintainers.pl | 2 +- .../lib/CPAN/Meta/Requirements.pm | 8 ++++---- cpan/CPAN-Meta-Requirements/t/basic.t | 18 ++++++++++++++++++ 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 0aa1a2f..0fb3137 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 e86dd56..8348559 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 882e324..ba029f4 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 94a5236..55a28be 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/, -- Perl5 Master Repository
