In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/c4fe132ef3ca192e7c810af629a85f88615267bc?hp=6dfba0aae8f42f8476fe450e6197024c9bd7a30e>
- Log ----------------------------------------------------------------- commit c4fe132ef3ca192e7c810af629a85f88615267bc Author: Chris 'BinGOs' Williams <[email protected]> Date: Mon Nov 17 16:24:17 2014 +0000 Update CPAN-Meta-Requirements to CPAN version 2.129 [DELTA] 2.129 2014-11-13 16:28:45-05:00 America/New_York [FIXED] - from_string_hash can now accept v-strings as hash values ----------------------------------------------------------------------- Summary of changes: Porting/Maintainers.pl | 2 +- .../lib/CPAN/Meta/Requirements.pm | 36 ++++++++++++++++------ cpan/CPAN-Meta-Requirements/t/from-hash.t | 18 +++++++++++ 3 files changed, 45 insertions(+), 11 deletions(-) diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index 94ae1b1..b8e8b79 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -300,7 +300,7 @@ use File::Glob qw(:case); }, 'CPAN::Meta::Requirements' => { - 'DISTRIBUTION' => 'DAGOLDEN/CPAN-Meta-Requirements-2.128.tar.gz', + 'DISTRIBUTION' => 'DAGOLDEN/CPAN-Meta-Requirements-2.129.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 727fb28..f313415 100644 --- a/cpan/CPAN-Meta-Requirements/lib/CPAN/Meta/Requirements.pm +++ b/cpan/CPAN-Meta-Requirements/lib/CPAN/Meta/Requirements.pm @@ -1,9 +1,10 @@ use strict; use warnings; package CPAN::Meta::Requirements; -our $VERSION = '2.128'; # VERSION # ABSTRACT: a set of version requirements for a CPAN dist +our $VERSION = '2.129'; + #pod =head1 SYNOPSIS #pod #pod use CPAN::Meta::Requirements; @@ -435,10 +436,12 @@ sub as_string_hash { #pod =method add_string_requirement #pod #pod $req->add_string_requirement('Library::Foo' => '>= 1.208, <= 2.206'); +#pod $req->add_string_requirement('Library::Foo' => v1.208); #pod #pod This method parses the passed in string and adds the appropriate requirement -#pod for the given module. It understands version ranges as described in the -#pod L<CPAN::Meta::Spec/Version Ranges>. For example: +#pod for the given module. A version can be a Perl "v-string". It understands +#pod version ranges as described in the L<CPAN::Meta::Spec/Version Ranges>. For +#pod example: #pod #pod =over 4 #pod @@ -480,8 +483,13 @@ sub add_string_requirement { Carp::confess("No requirement string provided for $module") unless defined $req && length $req; - my @parts = split qr{\s*,\s*}, $req; + my $magic = _find_magic_vstring( $req ); + if (length $magic) { + $self->add_minimum($module => $magic); + return; + } + my @parts = split qr{\s*,\s*}, $req; for my $part (@parts) { my ($op, $ver) = $part =~ m{\A\s*(==|>=|>|<=|<|!=)\s*(.*)\z}; @@ -503,7 +511,8 @@ sub add_string_requirement { #pod #pod This is an alternate constructor for a CPAN::Meta::Requirements object. It takes #pod a hash of module names and version requirement strings and returns a new -#pod CPAN::Meta::Requirements object. +#pod CPAN::Meta::Requirements object. As with add_string_requirement, a +#pod version can be a Perl "v-string". #pod #pod =cut @@ -735,7 +744,7 @@ CPAN::Meta::Requirements - a set of version requirements for a CPAN dist =head1 VERSION -version 2.128 +version 2.129 =head1 SYNOPSIS @@ -940,10 +949,12 @@ C<$hashref> would contain: =head2 add_string_requirement $req->add_string_requirement('Library::Foo' => '>= 1.208, <= 2.206'); + $req->add_string_requirement('Library::Foo' => v1.208); This method parses the passed in string and adds the appropriate requirement -for the given module. It understands version ranges as described in the -L<CPAN::Meta::Spec/Version Ranges>. For example: +for the given module. A version can be a Perl "v-string". It understands +version ranges as described in the L<CPAN::Meta::Spec/Version Ranges>. For +example: =over 4 @@ -974,7 +985,8 @@ A version number without an operator is equivalent to specifying a minimum This is an alternate constructor for a CPAN::Meta::Requirements object. It takes a hash of module names and version requirement strings and returns a new -CPAN::Meta::Requirements object. +CPAN::Meta::Requirements object. As with add_string_requirement, a +version can be a Perl "v-string". =for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan @@ -1011,12 +1023,16 @@ Ricardo Signes <[email protected]> =head1 CONTRIBUTORS -=for stopwords Karen Etheridge robario +=for stopwords Ed J Karen Etheridge robario =over 4 =item * +Ed J <[email protected]> + +=item * + Karen Etheridge <[email protected]> =item * diff --git a/cpan/CPAN-Meta-Requirements/t/from-hash.t b/cpan/CPAN-Meta-Requirements/t/from-hash.t index b05440d..451c374 100644 --- a/cpan/CPAN-Meta-Requirements/t/from-hash.t +++ b/cpan/CPAN-Meta-Requirements/t/from-hash.t @@ -66,4 +66,22 @@ sub dies_ok (&@) { } +{ + my $string_hash = { + Left => 10, + Shared => v50.44.60, + Right => 18, + }; + + my $warning; + local $SIG{__WARN__} = sub { $warning = join("\n",@_) }; + + my $req = CPAN::Meta::Requirements->from_string_hash($string_hash); + + ok( + $req->accepts_module(Shared => 'v50.44.60'), + "vstring treated as if string", + ); +} + done_testing; -- Perl5 Master Repository
