diff -Nru libcpan-meta-requirements-perl-2.133/Changes libcpan-meta-requirements-perl-2.140/Changes --- libcpan-meta-requirements-perl-2.133/Changes 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/Changes 2015-12-12 21:17:22.000000000 +0000 @@ -1,5 +1,44 @@ Revision history for CPAN-Meta-Requirements +2.140 2015-12-12 16:17:15-05:00 America/New_York + + - no changes from 2.139 + +2.139 2015-12-11 12:42:44-05:00 America/New_York (TRIAL RELEASE) + + - expanded dist.ini from author bundle to individual plugins + +2.138 2015-07-13 22:32:37-04:00 America/New_York (TRIAL RELEASE) + + - repackage with fixed tests + +2.137 2015-07-09 09:53:32-04:00 America/New_York (TRIAL RELEASE) + + - much better error messages, explaining what conflicted and how + +2.136 2015-06-08 21:35:27-06:00 America/Denver (TRIAL RELEASE) + + [FIXED] + + - On Perls before 5.8.1, pad 1-part and 2-part literal v-strings + to avoid old version.pm bugs with v-strings less than 3 characters + + - Protect internal _isa_version from non-refs that pass + ->isa('version') + +2.135 2015-05-19 13:15:35-04:00 America/New_York (TRIAL RELEASE) + + [TESTING] + + - Skips impossible tests on Perls earlier than 5.8.0 (before + v-string magic). + +2.134 2015-04-18 13:20:56+02:00 Europe/Berlin (TRIAL RELEASE) + + [ADDED] + + - Added method for getting structured requirements + 2.133 2015-02-22 06:35:34-05:00 America/New_York [FIXED] diff -Nru libcpan-meta-requirements-perl-2.133/cpanfile libcpan-meta-requirements-perl-2.140/cpanfile --- libcpan-meta-requirements-perl-2.133/cpanfile 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/cpanfile 2015-12-12 21:17:22.000000000 +0000 @@ -24,18 +24,71 @@ on 'develop' => sub { requires "Dist::Zilla" => "5"; + requires "Dist::Zilla::Plugin::Authority" => "0"; + requires "Dist::Zilla::Plugin::AutoPrereqs" => "0"; + requires "Dist::Zilla::Plugin::BumpVersionAfterRelease" => "0"; + requires "Dist::Zilla::Plugin::CPANFile" => "0"; + requires "Dist::Zilla::Plugin::CheckChangesHasContent" => "0"; + requires "Dist::Zilla::Plugin::CheckMetaResources" => "0"; + requires "Dist::Zilla::Plugin::CheckPrereqsIndexed" => "0"; + requires "Dist::Zilla::Plugin::ConfirmRelease" => "0"; + requires "Dist::Zilla::Plugin::CopyFilesFromBuild::Filtered" => "0"; + requires "Dist::Zilla::Plugin::ExecDir" => "0"; + requires "Dist::Zilla::Plugin::Git::Check" => "0"; + requires "Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch" => "0"; + requires "Dist::Zilla::Plugin::Git::Commit" => "0"; + requires "Dist::Zilla::Plugin::Git::Contributors" => "0"; + requires "Dist::Zilla::Plugin::Git::GatherDir" => "0"; + requires "Dist::Zilla::Plugin::Git::Push" => "0"; + requires "Dist::Zilla::Plugin::Git::Tag" => "0"; + requires "Dist::Zilla::Plugin::GithubMeta" => "0"; + requires "Dist::Zilla::Plugin::InsertCopyright" => "0"; + requires "Dist::Zilla::Plugin::License" => "0"; + requires "Dist::Zilla::Plugin::MakeMaker" => "0"; requires "Dist::Zilla::Plugin::MakeMaker::Highlander" => "0.003"; + requires "Dist::Zilla::Plugin::Manifest" => "0"; + requires "Dist::Zilla::Plugin::ManifestSkip" => "0"; + requires "Dist::Zilla::Plugin::MetaJSON" => "0"; + requires "Dist::Zilla::Plugin::MetaNoIndex" => "0"; + requires "Dist::Zilla::Plugin::MetaProvides::Package" => "0"; + requires "Dist::Zilla::Plugin::MetaTests" => "0"; + requires "Dist::Zilla::Plugin::MetaYAML" => "0"; + requires "Dist::Zilla::Plugin::MinimumPerl" => "0"; + requires "Dist::Zilla::Plugin::NextRelease" => "0"; + requires "Dist::Zilla::Plugin::OnlyCorePrereqs" => "0.014"; + requires "Dist::Zilla::Plugin::Pod2Readme" => "0"; + requires "Dist::Zilla::Plugin::PodCoverageTests" => "0"; + requires "Dist::Zilla::Plugin::PodSyntaxTests" => "0"; requires "Dist::Zilla::Plugin::Prereqs" => "0"; - requires "Dist::Zilla::PluginBundle::DAGOLDEN" => "0.072"; + requires "Dist::Zilla::Plugin::Prereqs::AuthorDeps" => "0"; + requires "Dist::Zilla::Plugin::PromptIfStale" => "0"; + requires "Dist::Zilla::Plugin::PruneCruft" => "0"; + requires "Dist::Zilla::Plugin::RewriteVersion" => "0"; + requires "Dist::Zilla::Plugin::RunExtraTests" => "0"; + requires "Dist::Zilla::Plugin::ShareDir" => "0"; + requires "Dist::Zilla::Plugin::SurgicalPodWeaver" => "0"; + requires "Dist::Zilla::Plugin::Test::Compile" => "0"; + requires "Dist::Zilla::Plugin::Test::MinimumVersion" => "0"; + requires "Dist::Zilla::Plugin::Test::Perl::Critic" => "0"; + requires "Dist::Zilla::Plugin::Test::PodSpelling" => "0"; + requires "Dist::Zilla::Plugin::Test::Portability" => "0"; + requires "Dist::Zilla::Plugin::Test::ReportPrereqs" => "0"; + requires "Dist::Zilla::Plugin::Test::Version" => "0"; + requires "Dist::Zilla::Plugin::TestRelease" => "0"; + requires "Dist::Zilla::Plugin::UploadToCPAN" => "0"; + requires "English" => "0"; requires "File::Spec" => "0"; requires "File::Temp" => "0"; requires "IO::Handle" => "0"; requires "IPC::Open3" => "0"; requires "Pod::Coverage::TrustPod" => "0"; + requires "Pod::Wordlist" => "0"; + requires "Software::License::Perl_5" => "0"; requires "Test::CPAN::Meta" => "0"; requires "Test::More" => "0"; requires "Test::Pod" => "1.41"; requires "Test::Pod::Coverage" => "1.08"; requires "Test::Spelling" => "0.12"; requires "Test::Version" => "1"; + requires "blib" => "1.01"; }; diff -Nru libcpan-meta-requirements-perl-2.133/debian/changelog libcpan-meta-requirements-perl-2.140/debian/changelog --- libcpan-meta-requirements-perl-2.133/debian/changelog 2015-05-06 18:06:28.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/debian/changelog 2015-12-13 14:31:32.000000000 +0000 @@ -1,3 +1,11 @@ +libcpan-meta-requirements-perl (2.140-1) unstable; urgency=medium + + * Import upstream version 2.140. + * Update debian/upstream/metadata. + * Bump debhelper compatibility level to 9. + + -- gregor herrmann Sun, 13 Dec 2015 15:31:25 +0100 + libcpan-meta-requirements-perl (2.133-1) unstable; urgency=medium * Drop debian/tests/control, add Testsuite field to debian/control diff -Nru libcpan-meta-requirements-perl-2.133/debian/compat libcpan-meta-requirements-perl-2.140/debian/compat --- libcpan-meta-requirements-perl-2.133/debian/compat 2015-05-06 18:06:28.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/debian/compat 2015-12-13 14:31:32.000000000 +0000 @@ -1 +1 @@ -8 +9 diff -Nru libcpan-meta-requirements-perl-2.133/debian/control libcpan-meta-requirements-perl-2.140/debian/control --- libcpan-meta-requirements-perl-2.133/debian/control 2015-05-06 18:06:28.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/debian/control 2015-12-13 14:31:32.000000000 +0000 @@ -3,7 +3,7 @@ Uploaders: gregor herrmann Section: perl Priority: optional -Build-Depends: debhelper (>= 8) +Build-Depends: debhelper (>= 9) Build-Depends-Indep: perl, perl (>= 5.13.9) | libversion-perl (>= 1:0.8800) Standards-Version: 3.9.6 diff -Nru libcpan-meta-requirements-perl-2.133/debian/upstream/metadata libcpan-meta-requirements-perl-2.140/debian/upstream/metadata --- libcpan-meta-requirements-perl-2.133/debian/upstream/metadata 2015-05-06 18:06:28.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/debian/upstream/metadata 2015-12-13 14:31:32.000000000 +0000 @@ -1,7 +1,7 @@ --- Archive: CPAN -Bug-Database: https://github.com/dagolden/CPAN-Meta-Requirements/issues +Bug-Database: https://github.com/Perl-Toolchain-Gang/CPAN-Meta-Requirements/issues Contact: David Golden , Ricardo Signes Name: CPAN-Meta-Requirements -Repository: https://github.com/dagolden/CPAN-Meta-Requirements.git -Repository-Browse: https://github.com/dagolden/CPAN-Meta-Requirements +Repository: https://github.com/Perl-Toolchain-Gang/CPAN-Meta-Requirements.git +Repository-Browse: https://github.com/Perl-Toolchain-Gang/CPAN-Meta-Requirements diff -Nru libcpan-meta-requirements-perl-2.133/dist.ini libcpan-meta-requirements-perl-2.140/dist.ini --- libcpan-meta-requirements-perl-2.133/dist.ini 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/dist.ini 2015-12-12 21:17:22.000000000 +0000 @@ -1,16 +1,158 @@ -name = CPAN-Meta-Requirements -author = David Golden -author = Ricardo Signes +; This file is generated from dist.ini.meta by dzil bakeini. +; Edit that file or the bundles contained within for long-term changes. +name = CPAN-Meta-Requirements +author = David Golden +author = Ricardo Signes license = Perl_5 copyright_holder = David Golden and Ricardo Signes -copyright_year = 2010 +copyright_year = 2010 -[@DAGOLDEN] -:version = 0.072 +[RewriteVersion / Dist::Zilla::PluginBundle::DAGOLDEN/RewriteVersion] + +[Git::Contributors / Dist::Zilla::PluginBundle::DAGOLDEN/Git::Contributors] + +[Git::GatherDir / Dist::Zilla::PluginBundle::DAGOLDEN/Git::GatherDir] +exclude_filename = README.mkdn +exclude_filename = cpanfile +exclude_filename = Makefile.PL + +[PruneCruft / Dist::Zilla::PluginBundle::DAGOLDEN/PruneCruft] + +[ManifestSkip / Dist::Zilla::PluginBundle::DAGOLDEN/ManifestSkip] + +[InsertCopyright / Dist::Zilla::PluginBundle::DAGOLDEN/InsertCopyright] + +[SurgicalPodWeaver / Dist::Zilla::PluginBundle::DAGOLDEN/SurgicalPodWeaver] +config_plugin = @DAGOLDEN +post_code_replacer = replace_with_nothing +replacer = replace_with_comment + +[Pod2Readme / Dist::Zilla::PluginBundle::DAGOLDEN/Pod2Readme] + +[License / Dist::Zilla::PluginBundle::DAGOLDEN/License] + +[Test::Compile / Dist::Zilla::PluginBundle::DAGOLDEN/Test::Compile] +fake_home = 1 +xt_mode = 1 + +[Test::MinimumVersion / Dist::Zilla::PluginBundle::DAGOLDEN/Test::MinimumVersion] +max_target_perl = 5.006 + +[Test::ReportPrereqs / Dist::Zilla::PluginBundle::DAGOLDEN/Test::ReportPrereqs] + +[Test::PodSpelling / Dist::Zilla::PluginBundle::DAGOLDEN/Test::PodSpelling] stopwords = invocant +stopwords = dist + +[Test::Perl::Critic / Dist::Zilla::PluginBundle::DAGOLDEN/Test::Perl::Critic] + +[MetaTests / Dist::Zilla::PluginBundle::DAGOLDEN/MetaTests] + +[PodSyntaxTests / Dist::Zilla::PluginBundle::DAGOLDEN/PodSyntaxTests] + +[PodCoverageTests / Dist::Zilla::PluginBundle::DAGOLDEN/PodCoverageTests] + +[Test::Portability / Dist::Zilla::PluginBundle::DAGOLDEN/Test::Portability] +options = test_one_dot = 0 + +[Test::Version / Dist::Zilla::PluginBundle::DAGOLDEN/Test::Version] + +[Authority / Dist::Zilla::PluginBundle::DAGOLDEN/Authority] +authority = cpan:DAGOLDEN +do_munging = 0 + +[MinimumPerl / Dist::Zilla::PluginBundle::DAGOLDEN/MinimumPerl] + +[AutoPrereqs / Dist::Zilla::PluginBundle::DAGOLDEN/AutoPrereqs] +skip = ^t::lib + +[MetaNoIndex / Dist::Zilla::PluginBundle::DAGOLDEN/MetaNoIndex] +directory = t +directory = xt +directory = examples +directory = corpus +package = DB + +[MetaProvides::Package / Dist::Zilla::PluginBundle::DAGOLDEN/MetaProvides::Package] +meta_noindex = 1 + +[GithubMeta / Dist::Zilla::PluginBundle::DAGOLDEN/GithubMeta] +issues = 1 +remote = origin +remote = github + +[Prereqs::AuthorDeps / Dist::Zilla::PluginBundle::DAGOLDEN/Prereqs::AuthorDeps] + +[MetaYAML / Dist::Zilla::PluginBundle::DAGOLDEN/MetaYAML] + +[MetaJSON / Dist::Zilla::PluginBundle::DAGOLDEN/MetaJSON] + +[CPANFile / Dist::Zilla::PluginBundle::DAGOLDEN/CPANFile] + +[ExecDir / Dist::Zilla::PluginBundle::DAGOLDEN/ExecDir] + +[ShareDir / Dist::Zilla::PluginBundle::DAGOLDEN/ShareDir] + +[MakeMaker / Dist::Zilla::PluginBundle::DAGOLDEN/MakeMaker] +default_jobs = 9 +eumm_version = 6.17 + +[PromptIfStale / Dist::Zilla::PluginBundle::DAGOLDEN/PromptIfStale] +check_all_plugins = 1 +modules = Dist::Zilla +modules = Dist::Zilla::PluginBundle::DAGOLDEN + +[CopyFilesFromBuild::Filtered / Dist::Zilla::PluginBundle::DAGOLDEN/CopyFilesFromBuild::Filtered] +copy = Makefile.PL + +[Manifest / Dist::Zilla::PluginBundle::DAGOLDEN/Manifest] + +[Git::CheckFor::CorrectBranch / Dist::Zilla::PluginBundle::DAGOLDEN/Git::CheckFor::CorrectBranch] + +[Git::Check / Dist::Zilla::PluginBundle::DAGOLDEN/Git::Check] +allow_dirty = Makefile.PL + +[CheckMetaResources / Dist::Zilla::PluginBundle::DAGOLDEN/CheckMetaResources] + +[CheckPrereqsIndexed / Dist::Zilla::PluginBundle::DAGOLDEN/CheckPrereqsIndexed] + +[CheckChangesHasContent / Dist::Zilla::PluginBundle::DAGOLDEN/CheckChangesHasContent] + +[RunExtraTests / Dist::Zilla::PluginBundle::DAGOLDEN/RunExtraTests] +default_jobs = 9 + +[TestRelease / Dist::Zilla::PluginBundle::DAGOLDEN/TestRelease] + +[ConfirmRelease / Dist::Zilla::PluginBundle::DAGOLDEN/ConfirmRelease] + +[UploadToCPAN / Dist::Zilla::PluginBundle::DAGOLDEN/UploadToCPAN] + +[Git::Commit / Dist::Zilla::PluginBundle::DAGOLDEN/Commit_Dirty_Files] +allow_dirty = Makefile.PL +commit_msg = Update Makefile.PL + +[Git::Tag / Dist::Zilla::PluginBundle::DAGOLDEN/Git::Tag] +tag_format = release-%v + +[NextRelease / Dist::Zilla::PluginBundle::DAGOLDEN/NextRelease] + +[BumpVersionAfterRelease / Dist::Zilla::PluginBundle::DAGOLDEN/BumpVersionAfterRelease] + +[Git::Commit / Dist::Zilla::PluginBundle::DAGOLDEN/Commit_Changes] +allow_dirty = Changes +allow_dirty = Makefile.PL +allow_dirty_match = ^lib +commit_msg = After release: bump $VERSION and timestamp Changes + +[Git::Push / Dist::Zilla::PluginBundle::DAGOLDEN/Git::Push] +push_to = origin [MakeMaker::Highlander] :version = 0.003 [Prereqs] version = 0.88 + +[OnlyCorePrereqs] +:version = 0.014 +check_dual_life_versions = 0 diff -Nru libcpan-meta-requirements-perl-2.133/lib/CPAN/Meta/Requirements.pm libcpan-meta-requirements-perl-2.140/lib/CPAN/Meta/Requirements.pm --- libcpan-meta-requirements-perl-2.133/lib/CPAN/Meta/Requirements.pm 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/lib/CPAN/Meta/Requirements.pm 2015-12-12 21:17:22.000000000 +0000 @@ -1,9 +1,10 @@ +use 5.006; # keep at v5.6 for CPAN.pm use strict; use warnings; package CPAN::Meta::Requirements; # ABSTRACT: a set of version requirements for a CPAN dist -our $VERSION = '2.133'; +our $VERSION = '2.140'; #pod =head1 SYNOPSIS #pod @@ -115,7 +116,7 @@ if (not defined $version or (!ref($version) && $version eq '0')) { return $V0; } - elsif ( ref($version) eq 'version' || _isa_version($version) ) { + elsif ( ref($version) eq 'version' || ( ref($version) && _isa_version($version) ) ) { $vobj = $version; } else { @@ -124,8 +125,14 @@ my $magic = _find_magic_vstring( $version ); $version = $magic if length $magic; } + # pad to 3 characters if before 5.8.1 and appears to be a v-string + if ( $] < 5.008001 && $version !~ /\A[0-9]/ && substr($version,0,1) ne 'v' && length($version) < 3 ) { + $version .= "\0" x (3 - length($version)); + } eval { local $SIG{__WARN__} = sub { die "Invalid version: $_[0]" }; + # avoid specific segfault on some older version.pm versions + die "Invalid version: $version" if $version eq 'version'; $vobj = version->new($version); }; if ( my $err = $@ ) { @@ -218,7 +225,7 @@ return $self; }; - + no strict 'refs'; *$to_add = $code; } @@ -237,7 +244,7 @@ if $self->is_finalized; $self->{requirements}{ $name } = - CPAN::Meta::Requirements::_Range::Range->with_minimum($V0); + CPAN::Meta::Requirements::_Range::Range->with_minimum($V0, $name); } else { $version = $self->_version_object( $name, $version ); @@ -251,9 +258,9 @@ #pod #pod $req->add_requirements( $another_req_object ); #pod -#pod This method adds all the requirements in the given CPAN::Meta::Requirements object -#pod to the requirements object on which it was called. If there are any conflicts, -#pod an exception is thrown. +#pod This method adds all the requirements in the given CPAN::Meta::Requirements +#pod object to the requirements object on which it was called. If there are any +#pod conflicts, an exception is thrown. #pod #pod This method returns the requirements object. #pod @@ -330,7 +337,7 @@ #pod the format described in L or undef if the given module has no #pod requirements. This should only be used for informational purposes such as error #pod messages and should not be interpreted or used for comparison (see -#pod L instead.) +#pod L instead). #pod #pod =cut @@ -341,6 +348,25 @@ return $entry->as_string; } +#pod =method structured_requirements_for_module +#pod +#pod $req->structured_requirements_for_module( $module ); +#pod +#pod This returns a data structure containing the version requirements for a given +#pod module or undef if the given module has no requirements. This should +#pod not be used for version checks (see L instead). +#pod +#pod Added in version 2.134. +#pod +#pod =cut + +sub structured_requirements_for_module { + my ($self, $module) = @_; + my $entry = $self->__entry_for($module); + return unless $entry; + return $entry->as_struct; +} + #pod =method required_modules #pod #pod This method returns a list of all the modules for which requirements have been @@ -378,7 +404,7 @@ if $fin and not $old; my $new = ($old || 'CPAN::Meta::Requirements::_Range::Range') - ->$method($version); + ->$method($version, $name); Carp::confess("can't modify finalized requirements") if $fin and $old->as_string ne $new->as_string; @@ -589,36 +615,62 @@ sub as_string { return "== $_[0]{version}" } + sub as_struct { return [ [ '==', "$_[0]{version}" ] ] } + sub as_modifiers { return [ [ exact_version => $_[0]{version} ] ] } + sub _reject_requirements { + my ($self, $module, $error) = @_; + Carp::confess("illegal requirements for $module: $error") + } + sub _clone { (ref $_[0])->_new( version->new( $_[0]{version} ) ) } sub with_exact_version { - my ($self, $version) = @_; + my ($self, $version, $module) = @_; + $module = 'module' unless defined $module; return $self->_clone if $self->_accepts($version); - Carp::confess("illegal requirements: unequal exact version specified"); + $self->_reject_requirements( + $module, + "can't be exactly $version when exact requirement is already $self->{version}", + ); } sub with_minimum { - my ($self, $minimum) = @_; + my ($self, $minimum, $module) = @_; + $module = 'module' unless defined $module; + return $self->_clone if $self->{version} >= $minimum; - Carp::confess("illegal requirements: minimum above exact specification"); + $self->_reject_requirements( + $module, + "minimum $minimum exceeds exact specification $self->{version}", + ); } sub with_maximum { - my ($self, $maximum) = @_; + my ($self, $maximum, $module) = @_; + $module = 'module' unless defined $module; + return $self->_clone if $self->{version} <= $maximum; - Carp::confess("illegal requirements: maximum below exact specification"); + $self->_reject_requirements( + $module, + "maximum $maximum below exact specification $self->{version}", + ); } sub with_exclusion { - my ($self, $exclusion) = @_; + my ($self, $exclusion, $module) = @_; + $module = 'module' unless defined $module; + return $self->_clone unless $exclusion == $self->{version}; - Carp::confess("illegal requirements: excluded exact specification"); + $self->_reject_requirements( + $module, + "tried to exclude $exclusion, which is already exactly specified", + ); } } @@ -655,61 +707,87 @@ return \@mods; } - sub as_string { + sub as_struct { my ($self) = @_; return 0 if ! keys %$self; - return "$self->{minimum}" if (keys %$self) == 1 and exists $self->{minimum}; - my @exclusions = @{ $self->{exclusions} || [] }; my @parts; - for my $pair ( + for my $tuple ( [ qw( >= > minimum ) ], [ qw( <= < maximum ) ], ) { - my ($op, $e_op, $k) = @$pair; + my ($op, $e_op, $k) = @$tuple; if (exists $self->{$k}) { my @new_exclusions = grep { $_ != $self->{ $k } } @exclusions; if (@new_exclusions == @exclusions) { - push @parts, "$op $self->{ $k }"; + push @parts, [ $op, "$self->{ $k }" ]; } else { - push @parts, "$e_op $self->{ $k }"; + push @parts, [ $e_op, "$self->{ $k }" ]; @exclusions = @new_exclusions; } } } - push @parts, map {; "!= $_" } @exclusions; + push @parts, map {; [ "!=", "$_" ] } @exclusions; + + return \@parts; + } + + sub as_string { + my ($self) = @_; + + my @parts = @{ $self->as_struct }; + + return $parts[0][1] if @parts == 1 and $parts[0][0] eq '>='; - return join q{, }, @parts; + return join q{, }, map {; join q{ }, @$_ } @parts; + } + + sub _reject_requirements { + my ($self, $module, $error) = @_; + Carp::confess("illegal requirements for $module: $error") } sub with_exact_version { - my ($self, $version) = @_; + my ($self, $version, $module) = @_; + $module = 'module' unless defined $module; $self = $self->_clone; - Carp::confess("illegal requirements: exact specification outside of range") - unless $self->_accepts($version); + unless ($self->_accepts($version)) { + $self->_reject_requirements( + $module, + "exact specification $version outside of range " . $self->as_string + ); + } return CPAN::Meta::Requirements::_Range::Exact->_new($version); } sub _simplify { - my ($self) = @_; + my ($self, $module) = @_; if (defined $self->{minimum} and defined $self->{maximum}) { if ($self->{minimum} == $self->{maximum}) { - Carp::confess("illegal requirements: excluded all values") - if grep { $_ == $self->{minimum} } @{ $self->{exclusions} || [] }; + if (grep { $_ == $self->{minimum} } @{ $self->{exclusions} || [] }) { + $self->_reject_requirements( + $module, + "minimum and maximum are both $self->{minimum}, which is excluded", + ); + } return CPAN::Meta::Requirements::_Range::Exact->_new($self->{minimum}) } - Carp::confess("illegal requirements: minimum exceeds maximum") - if $self->{minimum} > $self->{maximum}; + if ($self->{minimum} > $self->{maximum}) { + $self->_reject_requirements( + $module, + "minimum $self->{minimum} exceeds maximum $self->{maximum}", + ); + } } # eliminate irrelevant exclusions @@ -728,7 +806,8 @@ } sub with_minimum { - my ($self, $minimum) = @_; + my ($self, $minimum, $module) = @_; + $module = 'module' unless defined $module; $self = $self->_clone; if (defined (my $old_min = $self->{minimum})) { @@ -737,11 +816,12 @@ $self->{minimum} = $minimum; } - return $self->_simplify; + return $self->_simplify($module); } sub with_maximum { - my ($self, $maximum) = @_; + my ($self, $maximum, $module) = @_; + $module = 'module' unless defined $module; $self = $self->_clone; if (defined (my $old_max = $self->{maximum})) { @@ -750,16 +830,17 @@ $self->{maximum} = $maximum; } - return $self->_simplify; + return $self->_simplify($module); } sub with_exclusion { - my ($self, $exclusion) = @_; + my ($self, $exclusion, $module) = @_; + $module = 'module' unless defined $module; $self = $self->_clone; push @{ $self->{exclusions} ||= [] }, $exclusion; - return $self->_simplify; + return $self->_simplify($module); } sub _accepts { @@ -789,7 +870,7 @@ =head1 VERSION -version 2.133 +version 2.140 =head1 SYNOPSIS @@ -889,9 +970,9 @@ $req->add_requirements( $another_req_object ); -This method adds all the requirements in the given CPAN::Meta::Requirements object -to the requirements object on which it was called. If there are any conflicts, -an exception is thrown. +This method adds all the requirements in the given CPAN::Meta::Requirements +object to the requirements object on which it was called. If there are any +conflicts, an exception is thrown. This method returns the requirements object. @@ -926,7 +1007,17 @@ the format described in L or undef if the given module has no requirements. This should only be used for informational purposes such as error messages and should not be interpreted or used for comparison (see -L instead.) +L instead). + +=head2 structured_requirements_for_module + + $req->structured_requirements_for_module( $module ); + +This returns a data structure containing the version requirements for a given +module or undef if the given module has no requirements. This should +not be used for version checks (see L instead). + +Added in version 2.134. =head2 required_modules @@ -1043,7 +1134,7 @@ =head2 Bugs / Feature Requests Please report any bugs or feature requests through the issue tracker -at L. +at L. You will be notified automatically of any progress on your issue. =head2 Source Code @@ -1051,9 +1142,9 @@ This is open source software. The code repository is available for public review and contribution under the terms of the license. -L +L - git clone https://github.com/dagolden/CPAN-Meta-Requirements.git + git clone https://github.com/Perl-Toolchain-Gang/CPAN-Meta-Requirements.git =head1 AUTHORS diff -Nru libcpan-meta-requirements-perl-2.133/Makefile.PL libcpan-meta-requirements-perl-2.140/Makefile.PL --- libcpan-meta-requirements-perl-2.133/Makefile.PL 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/Makefile.PL 2015-12-12 21:17:22.000000000 +0000 @@ -1,4 +1,4 @@ -# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.032. +# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.042. use strict; use warnings; @@ -13,7 +13,6 @@ "ExtUtils::MakeMaker" => "6.17" }, "DISTNAME" => "CPAN-Meta-Requirements", - "EXE_FILES" => [], "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.006", "NAME" => "CPAN::Meta::Requirements", @@ -30,7 +29,7 @@ "Test::More" => "0.88", "version" => "0.88" }, - "VERSION" => "2.133", + "VERSION" => "2.140", "test" => { "TESTS" => "t/*.t" } @@ -40,7 +39,7 @@ my %FallbackPrereqs = ( "B" => 0, "Carp" => 0, - "ExtUtils::MakeMaker" => "6.17", + "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "Test::More" => "0.88", "strict" => 0, diff -Nru libcpan-meta-requirements-perl-2.133/MANIFEST libcpan-meta-requirements-perl-2.140/MANIFEST --- libcpan-meta-requirements-perl-2.133/MANIFEST 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/MANIFEST 2015-12-12 21:17:22.000000000 +0000 @@ -1,4 +1,4 @@ -# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.032. +# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.042. CONTRIBUTING.mkdn Changes LICENSE @@ -23,10 +23,10 @@ t/version-cleanup.t xt/author/00-compile.t xt/author/critic.t +xt/author/pod-coverage.t xt/author/pod-spell.t +xt/author/pod-syntax.t +xt/author/test-version.t xt/release/distmeta.t xt/release/minimum-version.t -xt/release/pod-coverage.t -xt/release/pod-syntax.t xt/release/portability.t -xt/release/test-version.t diff -Nru libcpan-meta-requirements-perl-2.133/META.json libcpan-meta-requirements-perl-2.140/META.json --- libcpan-meta-requirements-perl-2.133/META.json 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/META.json 2015-12-12 21:17:22.000000000 +0000 @@ -5,7 +5,7 @@ "Ricardo Signes " ], "dynamic_config" : 0, - "generated_by" : "Dist::Zilla version 5.032, CPAN::Meta::Converter version 2.143240", + "generated_by" : "Dist::Zilla version 5.042, CPAN::Meta::Converter version 2.150001", "license" : [ "perl_5" ], @@ -16,10 +16,10 @@ "name" : "CPAN-Meta-Requirements", "no_index" : { "directory" : [ - "t", - "xt", + "corpus", "examples", - "corpus" + "t", + "xt" ], "package" : [ "DB" @@ -35,20 +35,73 @@ "develop" : { "requires" : { "Dist::Zilla" : "5", + "Dist::Zilla::Plugin::Authority" : "0", + "Dist::Zilla::Plugin::AutoPrereqs" : "0", + "Dist::Zilla::Plugin::BumpVersionAfterRelease" : "0", + "Dist::Zilla::Plugin::CPANFile" : "0", + "Dist::Zilla::Plugin::CheckChangesHasContent" : "0", + "Dist::Zilla::Plugin::CheckMetaResources" : "0", + "Dist::Zilla::Plugin::CheckPrereqsIndexed" : "0", + "Dist::Zilla::Plugin::ConfirmRelease" : "0", + "Dist::Zilla::Plugin::CopyFilesFromBuild::Filtered" : "0", + "Dist::Zilla::Plugin::ExecDir" : "0", + "Dist::Zilla::Plugin::Git::Check" : "0", + "Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch" : "0", + "Dist::Zilla::Plugin::Git::Commit" : "0", + "Dist::Zilla::Plugin::Git::Contributors" : "0", + "Dist::Zilla::Plugin::Git::GatherDir" : "0", + "Dist::Zilla::Plugin::Git::Push" : "0", + "Dist::Zilla::Plugin::Git::Tag" : "0", + "Dist::Zilla::Plugin::GithubMeta" : "0", + "Dist::Zilla::Plugin::InsertCopyright" : "0", + "Dist::Zilla::Plugin::License" : "0", + "Dist::Zilla::Plugin::MakeMaker" : "0", "Dist::Zilla::Plugin::MakeMaker::Highlander" : "0.003", + "Dist::Zilla::Plugin::Manifest" : "0", + "Dist::Zilla::Plugin::ManifestSkip" : "0", + "Dist::Zilla::Plugin::MetaJSON" : "0", + "Dist::Zilla::Plugin::MetaNoIndex" : "0", + "Dist::Zilla::Plugin::MetaProvides::Package" : "0", + "Dist::Zilla::Plugin::MetaTests" : "0", + "Dist::Zilla::Plugin::MetaYAML" : "0", + "Dist::Zilla::Plugin::MinimumPerl" : "0", + "Dist::Zilla::Plugin::NextRelease" : "0", + "Dist::Zilla::Plugin::OnlyCorePrereqs" : "0.014", + "Dist::Zilla::Plugin::Pod2Readme" : "0", + "Dist::Zilla::Plugin::PodCoverageTests" : "0", + "Dist::Zilla::Plugin::PodSyntaxTests" : "0", "Dist::Zilla::Plugin::Prereqs" : "0", - "Dist::Zilla::PluginBundle::DAGOLDEN" : "0.072", + "Dist::Zilla::Plugin::Prereqs::AuthorDeps" : "0", + "Dist::Zilla::Plugin::PromptIfStale" : "0", + "Dist::Zilla::Plugin::PruneCruft" : "0", + "Dist::Zilla::Plugin::RewriteVersion" : "0", + "Dist::Zilla::Plugin::RunExtraTests" : "0", + "Dist::Zilla::Plugin::ShareDir" : "0", + "Dist::Zilla::Plugin::SurgicalPodWeaver" : "0", + "Dist::Zilla::Plugin::Test::Compile" : "0", + "Dist::Zilla::Plugin::Test::MinimumVersion" : "0", + "Dist::Zilla::Plugin::Test::Perl::Critic" : "0", + "Dist::Zilla::Plugin::Test::PodSpelling" : "0", + "Dist::Zilla::Plugin::Test::Portability" : "0", + "Dist::Zilla::Plugin::Test::ReportPrereqs" : "0", + "Dist::Zilla::Plugin::Test::Version" : "0", + "Dist::Zilla::Plugin::TestRelease" : "0", + "Dist::Zilla::Plugin::UploadToCPAN" : "0", + "English" : "0", "File::Spec" : "0", "File::Temp" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Pod::Coverage::TrustPod" : "0", + "Pod::Wordlist" : "0", + "Software::License::Perl_5" : "0", "Test::CPAN::Meta" : "0", "Test::More" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08", "Test::Spelling" : "0.12", - "Test::Version" : "1" + "Test::Version" : "1", + "blib" : "1.01" } }, "runtime" : { @@ -77,22 +130,22 @@ "provides" : { "CPAN::Meta::Requirements" : { "file" : "lib/CPAN/Meta/Requirements.pm", - "version" : "2.133" + "version" : "2.140" } }, "release_status" : "stable", "resources" : { "bugtracker" : { - "web" : "https://github.com/dagolden/CPAN-Meta-Requirements/issues" + "web" : "https://github.com/Perl-Toolchain-Gang/CPAN-Meta-Requirements/issues" }, - "homepage" : "https://github.com/dagolden/CPAN-Meta-Requirements", + "homepage" : "https://github.com/Perl-Toolchain-Gang/CPAN-Meta-Requirements", "repository" : { "type" : "git", - "url" : "https://github.com/dagolden/CPAN-Meta-Requirements.git", - "web" : "https://github.com/dagolden/CPAN-Meta-Requirements" + "url" : "https://github.com/Perl-Toolchain-Gang/CPAN-Meta-Requirements.git", + "web" : "https://github.com/Perl-Toolchain-Gang/CPAN-Meta-Requirements" } }, - "version" : "2.133", + "version" : "2.140", "x_authority" : "cpan:DAGOLDEN", "x_contributors" : [ "Ed J ", diff -Nru libcpan-meta-requirements-perl-2.133/META.yml libcpan-meta-requirements-perl-2.140/META.yml --- libcpan-meta-requirements-perl-2.133/META.yml 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/META.yml 2015-12-12 21:17:22.000000000 +0000 @@ -13,7 +13,7 @@ ExtUtils::MakeMaker: '6.17' perl: '5.006' dynamic_config: 0 -generated_by: 'Dist::Zilla version 5.032, CPAN::Meta::Converter version 2.143240' +generated_by: 'Dist::Zilla version 5.042, CPAN::Meta::Converter version 2.150001' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -21,16 +21,16 @@ name: CPAN-Meta-Requirements no_index: directory: + - corpus + - examples - t - xt - - examples - - corpus package: - DB provides: CPAN::Meta::Requirements: file: lib/CPAN/Meta/Requirements.pm - version: '2.133' + version: '2.140' requires: B: '0' Carp: '0' @@ -39,10 +39,10 @@ version: '0.88' warnings: '0' resources: - bugtracker: https://github.com/dagolden/CPAN-Meta-Requirements/issues - homepage: https://github.com/dagolden/CPAN-Meta-Requirements - repository: https://github.com/dagolden/CPAN-Meta-Requirements.git -version: '2.133' + bugtracker: https://github.com/Perl-Toolchain-Gang/CPAN-Meta-Requirements/issues + homepage: https://github.com/Perl-Toolchain-Gang/CPAN-Meta-Requirements + repository: https://github.com/Perl-Toolchain-Gang/CPAN-Meta-Requirements.git +version: '2.140' x_authority: cpan:DAGOLDEN x_contributors: - 'Ed J ' diff -Nru libcpan-meta-requirements-perl-2.133/README libcpan-meta-requirements-perl-2.140/README --- libcpan-meta-requirements-perl-2.133/README 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/README 2015-12-12 21:17:22.000000000 +0000 @@ -2,7 +2,7 @@ CPAN::Meta::Requirements - a set of version requirements for a CPAN dist VERSION - version 2.133 + version 2.140 SYNOPSIS use CPAN::Meta::Requirements; @@ -124,7 +124,16 @@ module in the format described in CPAN::Meta::Spec or undef if the given module has no requirements. This should only be used for informational purposes such as error messages and should not be interpreted or used - for comparison (see "accepts_module" instead.) + for comparison (see "accepts_module" instead). + + structured_requirements_for_module + $req->structured_requirements_for_module( $module ); + + This returns a data structure containing the version requirements for a + given module or undef if the given module has no requirements. This + should not be used for version checks (see "accepts_module" instead). + + Added in version 2.134. required_modules This method returns a list of all the modules for which requirements @@ -218,16 +227,16 @@ SUPPORT Bugs / Feature Requests Please report any bugs or feature requests through the issue tracker at - . You will be - notified automatically of any progress on your issue. + . + You will be notified automatically of any progress on your issue. Source Code This is open source software. The code repository is available for public review and contribution under the terms of the license. - + - git clone https://github.com/dagolden/CPAN-Meta-Requirements.git + git clone https://github.com/Perl-Toolchain-Gang/CPAN-Meta-Requirements.git AUTHORS * David Golden diff -Nru libcpan-meta-requirements-perl-2.133/t/00-report-prereqs.dd libcpan-meta-requirements-perl-2.140/t/00-report-prereqs.dd --- libcpan-meta-requirements-perl-2.133/t/00-report-prereqs.dd 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/t/00-report-prereqs.dd 2015-12-12 21:17:22.000000000 +0000 @@ -8,20 +8,73 @@ 'develop' => { 'requires' => { 'Dist::Zilla' => '5', + 'Dist::Zilla::Plugin::Authority' => '0', + 'Dist::Zilla::Plugin::AutoPrereqs' => '0', + 'Dist::Zilla::Plugin::BumpVersionAfterRelease' => '0', + 'Dist::Zilla::Plugin::CPANFile' => '0', + 'Dist::Zilla::Plugin::CheckChangesHasContent' => '0', + 'Dist::Zilla::Plugin::CheckMetaResources' => '0', + 'Dist::Zilla::Plugin::CheckPrereqsIndexed' => '0', + 'Dist::Zilla::Plugin::ConfirmRelease' => '0', + 'Dist::Zilla::Plugin::CopyFilesFromBuild::Filtered' => '0', + 'Dist::Zilla::Plugin::ExecDir' => '0', + 'Dist::Zilla::Plugin::Git::Check' => '0', + 'Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch' => '0', + 'Dist::Zilla::Plugin::Git::Commit' => '0', + 'Dist::Zilla::Plugin::Git::Contributors' => '0', + 'Dist::Zilla::Plugin::Git::GatherDir' => '0', + 'Dist::Zilla::Plugin::Git::Push' => '0', + 'Dist::Zilla::Plugin::Git::Tag' => '0', + 'Dist::Zilla::Plugin::GithubMeta' => '0', + 'Dist::Zilla::Plugin::InsertCopyright' => '0', + 'Dist::Zilla::Plugin::License' => '0', + 'Dist::Zilla::Plugin::MakeMaker' => '0', 'Dist::Zilla::Plugin::MakeMaker::Highlander' => '0.003', + 'Dist::Zilla::Plugin::Manifest' => '0', + 'Dist::Zilla::Plugin::ManifestSkip' => '0', + 'Dist::Zilla::Plugin::MetaJSON' => '0', + 'Dist::Zilla::Plugin::MetaNoIndex' => '0', + 'Dist::Zilla::Plugin::MetaProvides::Package' => '0', + 'Dist::Zilla::Plugin::MetaTests' => '0', + 'Dist::Zilla::Plugin::MetaYAML' => '0', + 'Dist::Zilla::Plugin::MinimumPerl' => '0', + 'Dist::Zilla::Plugin::NextRelease' => '0', + 'Dist::Zilla::Plugin::OnlyCorePrereqs' => '0.014', + 'Dist::Zilla::Plugin::Pod2Readme' => '0', + 'Dist::Zilla::Plugin::PodCoverageTests' => '0', + 'Dist::Zilla::Plugin::PodSyntaxTests' => '0', 'Dist::Zilla::Plugin::Prereqs' => '0', - 'Dist::Zilla::PluginBundle::DAGOLDEN' => '0.072', + 'Dist::Zilla::Plugin::Prereqs::AuthorDeps' => '0', + 'Dist::Zilla::Plugin::PromptIfStale' => '0', + 'Dist::Zilla::Plugin::PruneCruft' => '0', + 'Dist::Zilla::Plugin::RewriteVersion' => '0', + 'Dist::Zilla::Plugin::RunExtraTests' => '0', + 'Dist::Zilla::Plugin::ShareDir' => '0', + 'Dist::Zilla::Plugin::SurgicalPodWeaver' => '0', + 'Dist::Zilla::Plugin::Test::Compile' => '0', + 'Dist::Zilla::Plugin::Test::MinimumVersion' => '0', + 'Dist::Zilla::Plugin::Test::Perl::Critic' => '0', + 'Dist::Zilla::Plugin::Test::PodSpelling' => '0', + 'Dist::Zilla::Plugin::Test::Portability' => '0', + 'Dist::Zilla::Plugin::Test::ReportPrereqs' => '0', + 'Dist::Zilla::Plugin::Test::Version' => '0', + 'Dist::Zilla::Plugin::TestRelease' => '0', + 'Dist::Zilla::Plugin::UploadToCPAN' => '0', + 'English' => '0', 'File::Spec' => '0', 'File::Temp' => '0', 'IO::Handle' => '0', 'IPC::Open3' => '0', 'Pod::Coverage::TrustPod' => '0', + 'Pod::Wordlist' => '0', + 'Software::License::Perl_5' => '0', 'Test::CPAN::Meta' => '0', 'Test::More' => '0', 'Test::Pod' => '1.41', 'Test::Pod::Coverage' => '1.08', 'Test::Spelling' => '0.12', - 'Test::Version' => '1' + 'Test::Version' => '1', + 'blib' => '1.01' } }, 'runtime' => { diff -Nru libcpan-meta-requirements-perl-2.133/t/00-report-prereqs.t libcpan-meta-requirements-perl-2.140/t/00-report-prereqs.t --- libcpan-meta-requirements-perl-2.133/t/00-report-prereqs.t 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/t/00-report-prereqs.t 2015-12-12 21:17:22.000000000 +0000 @@ -3,7 +3,7 @@ use strict; use warnings; -# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.020 +# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.021 use Test::More tests => 1; diff -Nru libcpan-meta-requirements-perl-2.133/t/accepts.t libcpan-meta-requirements-perl-2.140/t/accepts.t --- libcpan-meta-requirements-perl-2.133/t/accepts.t 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/t/accepts.t 2015-12-12 21:17:22.000000000 +0000 @@ -8,32 +8,32 @@ { my $req = CPAN::Meta::Requirements->new->add_minimum(Foo => 1); - ok( $req->accepts_module(Foo => 1)); - ok(! $req->accepts_module(Foo => 0)); + ok( $req->accepts_module(Foo => 1), "need 1, got 1"); + ok(! $req->accepts_module(Foo => 0), "need 0, got 1"); } { my $req = CPAN::Meta::Requirements->new->add_minimum(Foo => 0); - ok( $req->accepts_module(Foo => 1)); - ok( $req->accepts_module(Foo => undef)); - ok( $req->accepts_module(Foo => "v0")); - ok( $req->accepts_module(Foo => v1.2.3)); - ok( $req->accepts_module(Foo => "v1.2.3")); + ok( $req->accepts_module(Foo => 1), "need 0, got 1"); + ok( $req->accepts_module(Foo => undef), "need 0, got undef"); + ok( $req->accepts_module(Foo => "v0"), "need 0, got 'v0'"); + ok( $req->accepts_module(Foo => v1.2.3), "need 0, got v1.2.3"); + ok( $req->accepts_module(Foo => "v1.2.3"), "need 0, got 'v1.2.3'"); } { my $req = CPAN::Meta::Requirements->new->add_maximum(Foo => 1); - ok( $req->accepts_module(Foo => 1)); - ok(! $req->accepts_module(Foo => 2)); + ok( $req->accepts_module(Foo => 1), "need <=1, got 1"); + ok(! $req->accepts_module(Foo => 2), "need <=1, got 2"); } { my $req = CPAN::Meta::Requirements->new->add_exclusion(Foo => 1); - ok( $req->accepts_module(Foo => 0)); - ok(! $req->accepts_module(Foo => 1)); + ok( $req->accepts_module(Foo => 0), "need !1, got 0"); + ok(! $req->accepts_module(Foo => 1), "need !1, got 1"); } done_testing; diff -Nru libcpan-meta-requirements-perl-2.133/t/bad_version_hook.t libcpan-meta-requirements-perl-2.140/t/bad_version_hook.t --- libcpan-meta-requirements-perl-2.133/t/bad_version_hook.t 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/t/bad_version_hook.t 2015-12-12 21:17:22.000000000 +0000 @@ -9,6 +9,7 @@ my %DATA = ( 'Foo::Bar' => [ 10, 10 ], 'Foo::Baz' => [ 'invalid_version', 42 ], + 'Foo::Qux' => [ 'version', 42 ], ); my %input = map { ($_ => $DATA{$_}->[0]) } keys %DATA; my %expected = map { ($_ => $DATA{$_}->[1]) } keys %DATA; @@ -16,6 +17,8 @@ sub dies_ok (&@) { my ($code, $qr, $comment) = @_; + no warnings 'redefine'; + local *Regexp::CARP_TRACE = sub { "" }; my $lived = eval { $code->(); 1 }; if ($lived) { @@ -26,14 +29,18 @@ } my $hook_text; -sub _fixit { my ($v, $m) = @_; $hook_text = $m; return version->new(42) } +sub _fixit { my ($v, $m) = @_; $hook_text .= $m; return version->new(42) } { my $req = CPAN::Meta::Requirements->new( {bad_version_hook => \&_fixit} ); my ($k, $v); - $req->add_minimum($k => $v) while ($k, $v) = each %input; - is $hook_text, 'Foo::Baz', 'hook stored module name'; + while (($k, $v) = each %input) { + note "adding minimum requirement: $k => $v"; + eval { $req->add_minimum($k => $v) }; + is( $@, '', "adding minimum '$k' for $v" ); + } + like( $hook_text, qr/Foo::Baz/, 'hook stored module name' ); is_deeply( $req->as_string_hash, diff -Nru libcpan-meta-requirements-perl-2.133/t/basic.t libcpan-meta-requirements-perl-2.140/t/basic.t --- libcpan-meta-requirements-perl-2.133/t/basic.t 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/t/basic.t 2015-12-12 21:17:22.000000000 +0000 @@ -8,6 +8,8 @@ sub dies_ok (&@) { my ($code, $qr, $comment) = @_; + no warnings 'redefine'; + local *Regexp::CARP_TRACE = sub { "" }; my $lived = eval { $code->(); 1 }; if ($lived) { @@ -126,7 +128,7 @@ $req->add_exclusion(Foo => 1); dies_ok { $req->add_maximum(Foo => 1); } - qr/excluded all/, + qr/both 1, which is excluded/, "can't exclude all values" ; } @@ -142,13 +144,13 @@ my $req = CPAN::Meta::Requirements->new; $req->add_minimum(Foo => 1); dies_ok { $req->add_maximum(Foo => 0.5); } - qr/minimum exceeds maximum/, + qr/minimum 1 exceeds maximum/, "maximum must exceed (or equal) minimum"; $req = CPAN::Meta::Requirements->new; $req->add_maximum(Foo => 0.5); dies_ok { $req->add_minimum(Foo => 1); } - qr/minimum exceeds maximum/, + qr/minimum 1 exceeds maximum/, "maximum must exceed (or equal) minimum"; } @@ -188,6 +190,18 @@ }, 'test exclusion-skipping', ); + + is_deeply( + $req->structured_requirements_for_module('Foo'), + # remember, it's okay to change the exact results, as long as the meaning + # is unchanged -- rjbs, 2012-07-11 + [ + [ '>=', '1' ], + [ '<=', '3' ], + [ '!=', '2' ], + ], + "structured requirements for Foo", + ); } sub foo_1 { @@ -204,21 +218,21 @@ is_deeply($req->as_string_hash, { Foo => '== 1' }, "exact requirement"); dies_ok { $req->exact_version(Foo => 2); } - qr/unequal/, + qr/can't be exactly 2.+already/, "can't exactly specify differing versions" ; $req = foo_1; $req->add_minimum(Foo => 0); # ignored $req->add_maximum(Foo => 2); # ignored - dies_ok { $req->add_maximum(Foo => 0); } qr/maximum below/, "max < fixed"; + dies_ok { $req->add_maximum(Foo => 0); } qr/maximum 0 below exact/, "max < fixed"; $req = foo_1; - dies_ok { $req->add_minimum(Foo => 2); } qr/minimum above/, "min > fixed"; + dies_ok { $req->add_minimum(Foo => 2); } qr/minimum 2 exceeds exact/, "min > fixed"; $req = foo_1; $req->add_exclusion(Foo => 8); # ignored - dies_ok { $req->add_exclusion(Foo => 1); } qr/excluded exact/, "!= && =="; + dies_ok { $req->add_exclusion(Foo => 1); } qr/tried to exclude/, "!= && =="; } { @@ -226,6 +240,12 @@ is($req->requirements_for_module('Foo'), '== 1', 'requirements_for_module'); + is_deeply( + $req->structured_requirements_for_module('Foo'), + [ [ '==', '1' ] ], + 'structured_requirements_for_module' + ); + # test empty/undef returns my @list = $req->requirements_for_module('FooBarBamBaz'); my $scalar = $req->requirements_for_module('FooBarBamBaz'); diff -Nru libcpan-meta-requirements-perl-2.133/t/finalize.t libcpan-meta-requirements-perl-2.140/t/finalize.t --- libcpan-meta-requirements-perl-2.133/t/finalize.t 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/t/finalize.t 2015-12-12 21:17:22.000000000 +0000 @@ -8,6 +8,8 @@ sub dies_ok (&@) { my ($code, $qr, $comment) = @_; + no warnings 'redefine'; + local *Regexp::CARP_TRACE = sub { "" }; my $lived = eval { $code->(); 1 }; if ($lived) { diff -Nru libcpan-meta-requirements-perl-2.133/t/from-hash.t libcpan-meta-requirements-perl-2.140/t/from-hash.t --- libcpan-meta-requirements-perl-2.133/t/from-hash.t 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/t/from-hash.t 2015-12-12 21:17:22.000000000 +0000 @@ -8,6 +8,8 @@ sub dies_ok (&@) { my ($code, $qr, $comment) = @_; + no warnings 'redefine'; + local *Regexp::CARP_TRACE = sub { "" }; my $lived = eval { $code->(); 1 }; if ($lived) { @@ -33,7 +35,9 @@ ); } -{ +SKIP: { + skip "Can't tell v-strings from strings until 5.8.1", 1 + unless $] gt '5.008'; my $string_hash = { Left => 10, Shared => '= 2', @@ -64,7 +68,9 @@ ); } -{ +SKIP: { + skip "Can't tell v-strings from strings until 5.8.1", 2 + unless $] gt '5.008'; my $string_hash = { Left => 10, Shared => v50.44.60, @@ -74,7 +80,8 @@ my $warning; local $SIG{__WARN__} = sub { $warning = join("\n",@_) }; - my $req = CPAN::Meta::Requirements->from_string_hash($string_hash); + my $req = eval { CPAN::Meta::Requirements->from_string_hash($string_hash); }; + is( $@, '', "vstring in string hash lives" ); ok( $req->accepts_module(Shared => 'v50.44.60'), diff -Nru libcpan-meta-requirements-perl-2.133/t/merge.t libcpan-meta-requirements-perl-2.140/t/merge.t --- libcpan-meta-requirements-perl-2.133/t/merge.t 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/t/merge.t 2015-12-12 21:17:22.000000000 +0000 @@ -8,6 +8,8 @@ sub dies_ok (&@) { my ($code, $qr, $comment) = @_; + no warnings 'redefine'; + local *Regexp::CARP_TRACE = sub { "" }; my $lived = eval { $code->(); 1 }; if ($lived) { diff -Nru libcpan-meta-requirements-perl-2.133/t/strings.t libcpan-meta-requirements-perl-2.140/t/strings.t --- libcpan-meta-requirements-perl-2.133/t/strings.t 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/t/strings.t 2015-12-12 21:17:22.000000000 +0000 @@ -5,6 +5,8 @@ sub dies_ok (&@) { my ($code, $qr, $comment) = @_; + no warnings 'redefine'; + local *Regexp::CARP_TRACE = sub { "" }; my $lived = eval { $code->(); 1 }; if ($lived) { diff -Nru libcpan-meta-requirements-perl-2.133/t/version-cleanup.t libcpan-meta-requirements-perl-2.140/t/version-cleanup.t --- libcpan-meta-requirements-perl-2.133/t/version-cleanup.t 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/t/version-cleanup.t 2015-12-12 21:17:22.000000000 +0000 @@ -8,6 +8,8 @@ my @cases = ( [ "2-part literal v-string" => v1.2 => "v1.2.0" ], + [ "1-part literal v-string" => v1 => "v1.0.0" ], + [ "1-part literal v-string (0)" => v0 => "v0.0.0" ], ); for my $c (@cases) { diff -Nru libcpan-meta-requirements-perl-2.133/xt/author/00-compile.t libcpan-meta-requirements-perl-2.140/xt/author/00-compile.t --- libcpan-meta-requirements-perl-2.133/xt/author/00-compile.t 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/xt/author/00-compile.t 2015-12-12 21:17:22.000000000 +0000 @@ -2,11 +2,11 @@ use strict; use warnings; -# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.051 +# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.054 use Test::More; -plan tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0); +plan tests => 2; my @module_files = ( 'CPAN/Meta/Requirements.pm' @@ -39,6 +39,9 @@ waitpid($pid, 0); is($?, 0, "$lib loaded ok"); + shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ + and not eval { require blib; blib->VERSION('1.01') }; + if (@_warnings) { warn @_warnings; @@ -49,6 +52,6 @@ is(scalar(@warnings), 0, 'no warnings found') - or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING}; + or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ); diff -Nru libcpan-meta-requirements-perl-2.133/xt/author/pod-coverage.t libcpan-meta-requirements-perl-2.140/xt/author/pod-coverage.t --- libcpan-meta-requirements-perl-2.133/xt/author/pod-coverage.t 1970-01-01 00:00:00.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/xt/author/pod-coverage.t 2015-12-12 21:17:22.000000000 +0000 @@ -0,0 +1,7 @@ +#!perl +# This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. + +use Test::Pod::Coverage 1.08; +use Pod::Coverage::TrustPod; + +all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); diff -Nru libcpan-meta-requirements-perl-2.133/xt/author/pod-spell.t libcpan-meta-requirements-perl-2.140/xt/author/pod-spell.t --- libcpan-meta-requirements-perl-2.133/xt/author/pod-spell.t 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/xt/author/pod-spell.t 2015-12-12 21:17:22.000000000 +0000 @@ -2,7 +2,7 @@ use warnings; use Test::More; -# generated by Dist::Zilla::Plugin::Test::PodSpelling 2.006008 +# generated by Dist::Zilla::Plugin::Test::PodSpelling 2.007000 use Test::Spelling 0.12; use Pod::Wordlist; @@ -11,6 +11,7 @@ all_pod_files_spelling_ok( qw( bin lib ) ); __DATA__ invocant +dist David Golden dagolden diff -Nru libcpan-meta-requirements-perl-2.133/xt/author/pod-syntax.t libcpan-meta-requirements-perl-2.140/xt/author/pod-syntax.t --- libcpan-meta-requirements-perl-2.133/xt/author/pod-syntax.t 1970-01-01 00:00:00.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/xt/author/pod-syntax.t 2015-12-12 21:17:22.000000000 +0000 @@ -0,0 +1,7 @@ +#!perl +# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. +use strict; use warnings; +use Test::More; +use Test::Pod 1.41; + +all_pod_files_ok(); diff -Nru libcpan-meta-requirements-perl-2.133/xt/author/test-version.t libcpan-meta-requirements-perl-2.140/xt/author/test-version.t --- libcpan-meta-requirements-perl-2.133/xt/author/test-version.t 1970-01-01 00:00:00.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/xt/author/test-version.t 2015-12-12 21:17:22.000000000 +0000 @@ -0,0 +1,24 @@ +use strict; +use warnings; +use Test::More; + +# generated by Dist::Zilla::Plugin::Test::Version 1.05 +use Test::Version; + +my @imports = qw( version_all_ok ); + +my $params = { + is_strict => 0, + has_version => 1, + multiple => 0, + +}; + +push @imports, $params + if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); + + +Test::Version->import(@imports); + +version_all_ok; +done_testing; diff -Nru libcpan-meta-requirements-perl-2.133/xt/release/minimum-version.t libcpan-meta-requirements-perl-2.140/xt/release/minimum-version.t --- libcpan-meta-requirements-perl-2.133/xt/release/minimum-version.t 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/xt/release/minimum-version.t 2015-12-12 21:17:22.000000000 +0000 @@ -5,4 +5,4 @@ eval "use Test::MinimumVersion"; plan skip_all => "Test::MinimumVersion required for testing minimum versions" if $@; -all_minimum_version_ok( qq{5.010} ); +all_minimum_version_ok( qq{5.006} ); diff -Nru libcpan-meta-requirements-perl-2.133/xt/release/pod-coverage.t libcpan-meta-requirements-perl-2.140/xt/release/pod-coverage.t --- libcpan-meta-requirements-perl-2.133/xt/release/pod-coverage.t 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/xt/release/pod-coverage.t 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -#!perl -# This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. - -use Test::Pod::Coverage 1.08; -use Pod::Coverage::TrustPod; - -all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); diff -Nru libcpan-meta-requirements-perl-2.133/xt/release/pod-syntax.t libcpan-meta-requirements-perl-2.140/xt/release/pod-syntax.t --- libcpan-meta-requirements-perl-2.133/xt/release/pod-syntax.t 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/xt/release/pod-syntax.t 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -#!perl -# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. -use Test::More; -use Test::Pod 1.41; - -all_pod_files_ok(); diff -Nru libcpan-meta-requirements-perl-2.133/xt/release/test-version.t libcpan-meta-requirements-perl-2.140/xt/release/test-version.t --- libcpan-meta-requirements-perl-2.133/xt/release/test-version.t 2015-02-22 11:35:39.000000000 +0000 +++ libcpan-meta-requirements-perl-2.140/xt/release/test-version.t 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -use strict; -use warnings; -use Test::More; - -# generated by Dist::Zilla::Plugin::Test::Version 0.003001 -use Test::Version; - -my @imports = ( 'version_all_ok' ); - -my $params = { - is_strict => 0, - has_version => 1, -}; - -push @imports, $params - if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); - - -Test::Version->import(@imports); - -version_all_ok; -done_testing;