CPAN-Meta-Requirements-2.125/000755 000765 000024 00000000000 12220106647 016043 5ustar00davidstaff000000 000000 CPAN-Meta-Requirements-2.125/Changes000644 000765 000024 00000002133 12220106647 017335 0ustar00davidstaff000000 000000 Revision history for CPAN-Meta-Requirements 2.125 2013-09-23 14:51:14 America/New_York [FIXED] - updated Makefile.PL logic to support PERL_NO_HIGHLANDER 2.124 2013-09-23 06:40:07 America/New_York [FIXED] - Better fix than 2.123. On old perls, rather than install into 'core', we continue to install into the proper 'site' library, but force UNINST=1 when necessary to remove stale copies from ExtUtils::MakeMaker 2.123 2013-08-30 12:17:14 America/New_York [FIXED] - On Perls prior to v5.12, CPAN::Meta::Requirements will be installed into the 'core' library path to avoid an older version bundled with ExtUtils::MakeMaker and installed there taking precedence. 2.122 2012-05-02 17:29:17 America/New_York [FIXED] - Fix typo in documentation: the exclusion symbol is "!=" rather than just "!". The implemenation was correct, just the docs were wrong. [rt.cpan.org #76948; ticket and patch from hasch-cpan@cozap.com] 2.121 2012-04-01 15:05:15 Europe/Paris - Split out from CPAN::Meta into own distribution CPAN-Meta-Requirements-2.125/CONTRIBUTING000644 000765 000024 00000004234 12220106647 017700 0ustar00davidstaff000000 000000 ## HOW TO CONTRIBUTE Thank you for considering contributing to this distribution. This file contains instructions that will help you work with the source code. The distribution is managed with Dist::Zilla. This means than many of the usual files you might expect are not in the repository, but are generated at release time (e.g. Makefile.PL). ### Getting dependencies See the included `cpanfile` file for a list of dependencies. If you have App::cpanminus 1.6 or later installed, you can use `cpanm` to satisfy dependencies like this: $ cpanm --installdeps . Otherwise, you can install Module::CPANfile 1.0002 or later and then satisfy dependencies with the regular `cpan` client and `cpanfile-dump`: $ cpan `cpanfile-dump` ### Running tests You can run tests directly using the `prove` tool: $ prove -l $ prove -lv t/some_test_file.t For most distributions, `prove` is entirely sufficent for you to test any patches you have. ### Code style and tidying Please try to match any existing coding style. If there is a `.perltidyrc` file, please install Perl::Tidy and use perltidy before submitting patches. If there is a `tidyall.ini` file, you can also install Code::TidyAll and run `tidyall` on a file or `tidyall -a` to tidy all files. ### Patching documentation Much of the documentation Pod is generated at release time. Depending on the distribution, some documentation may be written in a Pod dialect called WikiDoc. (See Pod::WikiDoc on CPAN.) If you would like to submit a documentation edit, please limit yourself to the documentation you see. If you see typos or documentation issues in the generated docs, please email or open a bug ticket instead of patching. ### Learning Dist::Zilla Dist::Zilla is a very powerful authoring tool, but requires a number of author-specific plugins. If you would like to use it for contributing, install it from CPAN, then run one of the following commands, depending on your CPAN client: $ cpan `dzil authordeps` $ dzil authordeps | cpanm Once installed, here are some dzil commands you might try: $ dzil build $ dzil test $ dzil xtest You can learn more about Dist::Zilla at http://dzil.org/ CPAN-Meta-Requirements-2.125/cpanfile000644 000765 000024 00000001331 12220106647 017545 0ustar00davidstaff000000 000000 requires "Carp" => "0"; requires "Scalar::Util" => "0"; requires "perl" => "5.006"; requires "strict" => "0"; requires "version" => "0.77"; requires "warnings" => "0"; on 'test' => sub { requires "ExtUtils::MakeMaker" => "0"; requires "File::Spec" => "0"; requires "File::Spec::Functions" => "0"; requires "File::Temp" => "0"; requires "IO::Handle" => "0"; requires "IPC::Open3" => "0"; requires "List::Util" => "0"; requires "Test::More" => "0.88"; }; on 'configure' => sub { requires "ExtUtils::MakeMaker" => "6.17"; }; on 'develop' => sub { requires "Pod::Coverage::TrustPod" => "0"; requires "Test::CPAN::Meta" => "0"; requires "Test::Pod" => "1.41"; requires "Test::Pod::Coverage" => "1.08"; }; CPAN-Meta-Requirements-2.125/dist.ini000644 000765 000024 00000000543 12220106647 017511 0ustar00davidstaff000000 000000 name = CPAN-Meta-Requirements author = David Golden author = Ricardo Signes license = Perl_5 copyright_holder = David Golden and Ricardo Signes copyright_year = 2010 [@DAGOLDEN] :version = 0.053 -remove = MakeMaker stopwords = invocant [MakeMaker] eumm_version = 6.17 [MakeMaker::Highlander] :version = 0.003 CPAN-Meta-Requirements-2.125/lib/000755 000765 000024 00000000000 12220106647 016611 5ustar00davidstaff000000 000000 CPAN-Meta-Requirements-2.125/LICENSE000644 000765 000024 00000043744 12220106647 017064 0ustar00davidstaff000000 000000 This software is copyright (c) 2010 by David Golden and Ricardo Signes. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2010 by David Golden and Ricardo Signes. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2010 by David Golden and Ricardo Signes. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End CPAN-Meta-Requirements-2.125/Makefile.PL000644 000765 000024 00000003724 12220106647 020023 0ustar00davidstaff000000 000000 use strict; use warnings; use 5.006; use ExtUtils::MakeMaker 6.17; my %WriteMakefileArgs = ( "ABSTRACT" => "a set of version requirements for a CPAN dist", "AUTHOR" => "David Golden , Ricardo Signes ", "BUILD_REQUIRES" => {}, "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.17" }, "DISTNAME" => "CPAN-Meta-Requirements", "EXE_FILES" => [], "LICENSE" => "perl", "NAME" => "CPAN::Meta::Requirements", "PREREQ_PM" => { "Carp" => 0, "Scalar::Util" => 0, "strict" => 0, "version" => "0.77", "warnings" => 0 }, "TEST_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "File::Spec::Functions" => 0, "File::Temp" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "List::Util" => 0, "Test::More" => "0.88" }, "VERSION" => "2.125", "test" => { "TESTS" => "t/*.t" } ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { my $tr = delete $WriteMakefileArgs{TEST_REQUIRES}; my $br = $WriteMakefileArgs{BUILD_REQUIRES}; for my $mod ( keys %$tr ) { if ( exists $br->{$mod} ) { $br->{$mod} = $tr->{$mod} if $tr->{$mod} > $br->{$mod}; } else { $br->{$mod} = $tr->{$mod}; } } } unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) { my $br = delete $WriteMakefileArgs{BUILD_REQUIRES}; my $pp = $WriteMakefileArgs{PREREQ_PM}; for my $mod ( keys %$br ) { if ( exists $pp->{$mod} ) { $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod}; } else { $pp->{$mod} = $br->{$mod}; } } } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; # Added by Dist::Zilla::Plugin::MakeMaker::Highlander if ( $] < 5.012 && ! $ENV{PERL_NO_HIGHLANDER} && ! ( $ENV{PERL_MM_OPT} && $ENV{PERL_MM_OPT} =~ /(?:INSTALL_BASE|PREFIX)/ ) && ! grep { /INSTALL_BASE/ || /PREFIX/ } @ARGV ) { $WriteMakefileArgs{UNINST} = 1; } WriteMakefile(%WriteMakefileArgs); CPAN-Meta-Requirements-2.125/MANIFEST000644 000765 000024 00000000700 12220106647 017171 0ustar00davidstaff000000 000000 CONTRIBUTING Changes LICENSE MANIFEST META.json META.yml Makefile.PL README cpanfile dist.ini lib/CPAN/Meta/Requirements.pm perlcritic.rc t/00-compile.t t/00-report-prereqs.t t/accepts.t t/bad_version_hook.t t/basic.t t/finalize.t t/from-hash.t t/merge.t xt/author/critic.t xt/author/pod-spell.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 CPAN-Meta-Requirements-2.125/META.json000644 000765 000024 00000004264 12220106647 017472 0ustar00davidstaff000000 000000 { "abstract" : "a set of version requirements for a CPAN dist", "author" : [ "David Golden ", "Ricardo Signes " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 4.300039, CPAN::Meta::Converter version 2.132660", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "CPAN-Meta-Requirements", "no_index" : { "directory" : [ "t", "xt", "examples", "corpus" ], "package" : [ "DB" ] }, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.17" } }, "develop" : { "requires" : { "Pod::Coverage::TrustPod" : "0", "Test::CPAN::Meta" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08" } }, "runtime" : { "requires" : { "Carp" : "0", "Scalar::Util" : "0", "perl" : "5.006", "strict" : "0", "version" : "0.77", "warnings" : "0" } }, "test" : { "requires" : { "ExtUtils::MakeMaker" : "0", "File::Spec" : "0", "File::Spec::Functions" : "0", "File::Temp" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "List::Util" : "0", "Test::More" : "0.88" } } }, "provides" : { "CPAN::Meta::Requirements" : { "file" : "lib/CPAN/Meta/Requirements.pm", "version" : "2.125" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/dagolden/CPAN-Meta-Requirements/issues" }, "homepage" : "https://github.com/dagolden/CPAN-Meta-Requirements", "repository" : { "type" : "git", "url" : "https://github.com/dagolden/CPAN-Meta-Requirements.git", "web" : "https://github.com/dagolden/CPAN-Meta-Requirements" } }, "version" : "2.125", "x_authority" : "cpan:DAGOLDEN" } CPAN-Meta-Requirements-2.125/META.yml000644 000765 000024 00000002154 12220106647 017316 0ustar00davidstaff000000 000000 --- abstract: 'a set of version requirements for a CPAN dist' author: - 'David Golden ' - 'Ricardo Signes ' build_requires: ExtUtils::MakeMaker: 0 File::Spec: 0 File::Spec::Functions: 0 File::Temp: 0 IO::Handle: 0 IPC::Open3: 0 List::Util: 0 Test::More: 0.88 configure_requires: ExtUtils::MakeMaker: 6.17 dynamic_config: 0 generated_by: 'Dist::Zilla version 4.300039, CPAN::Meta::Converter version 2.132660' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: CPAN-Meta-Requirements no_index: directory: - t - xt - examples - corpus package: - DB provides: CPAN::Meta::Requirements: file: lib/CPAN/Meta/Requirements.pm version: 2.125 requires: Carp: 0 Scalar::Util: 0 perl: 5.006 strict: 0 version: 0.77 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.125 x_authority: cpan:DAGOLDEN CPAN-Meta-Requirements-2.125/perlcritic.rc000644 000765 000024 00000001075 12220106647 020534 0ustar00davidstaff000000 000000 severity = 5 verbose = 8 [Variables::ProhibitPunctuationVars] allow = $@ $! [TestingAndDebugging::ProhibitNoStrict] allow = refs # Turn these off [-BuiltinFunctions::ProhibitStringyEval] [-ControlStructures::ProhibitPostfixControls] [-ControlStructures::ProhibitUnlessBlocks] [-Documentation::RequirePodSections] [-InputOutput::ProhibitInteractiveTest] [-Miscellanea::RequireRcsKeywords] [-References::ProhibitDoubleSigils] [-RegularExpressions::RequireExtendedFormatting] [-InputOutput::ProhibitTwoArgOpen] # Turn this on [Lax::ProhibitStringyEval::ExceptForRequire] CPAN-Meta-Requirements-2.125/README000644 000765 000024 00000016632 12220106647 016733 0ustar00davidstaff000000 000000 NAME CPAN::Meta::Requirements - a set of version requirements for a CPAN dist VERSION version 2.125 SYNOPSIS use CPAN::Meta::Requirements; my $build_requires = CPAN::Meta::Requirements->new; $build_requires->add_minimum('Library::Foo' => 1.208); $build_requires->add_minimum('Library::Foo' => 2.602); $build_requires->add_minimum('Module::Bar' => 'v1.2.3'); $METAyml->{build_requires} = $build_requires->as_string_hash; DESCRIPTION A CPAN::Meta::Requirements object models a set of version constraints like those specified in the META.yml or META.json files in CPAN distributions. It can be built up by adding more and more constraints, and it will reduce them to the simplest representation. Logically impossible constraints will be identified immediately by thrown exceptions. METHODS new my $req = CPAN::Meta::Requirements->new; This returns a new CPAN::Meta::Requirements object. It takes an optional hash reference argument. The following keys are supported: * -- if provided, when a version cannot be parsed into a version object, this code reference will be called with the invalid version string as an argument. It must return a valid version object. All other keys are ignored. add_minimum $req->add_minimum( $module => $version ); This adds a new minimum version requirement. If the new requirement is redundant to the existing specification, this has no effect. Minimum requirements are inclusive. $version is required, along with any greater version number. This method returns the requirements object. add_maximum $req->add_maximum( $module => $version ); This adds a new maximum version requirement. If the new requirement is redundant to the existing specification, this has no effect. Maximum requirements are inclusive. No version strictly greater than the given version is allowed. This method returns the requirements object. add_exclusion $req->add_exclusion( $module => $version ); This adds a new excluded version. For example, you might use these three method calls: $req->add_minimum( $module => '1.00' ); $req->add_maximum( $module => '1.82' ); $req->add_exclusion( $module => '1.75' ); Any version between 1.00 and 1.82 inclusive would be acceptable, except for 1.75. This method returns the requirements object. exact_version $req->exact_version( $module => $version ); This sets the version required for the given module to *exactly* the given version. No other version would be considered acceptable. This method returns the requirements object. add_requirements $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 returns the requirements object. accepts_module my $bool = $req->accepts_modules($module => $version); Given an module and version, this method returns true if the version specification for the module accepts the provided version. In other words, given: Module => '>= 1.00, < 2.00' We will accept 1.00 and 1.75 but not 0.50 or 2.00. For modules that do not appear in the requirements, this method will return true. clear_requirement $req->clear_requirement( $module ); This removes the requirement for a given module from the object. This method returns the requirements object. requirements_for_module $req->requirements_for_module( $module ); This returns a string containing the version requirements for a given 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.) required_modules This method returns a list of all the modules for which requirements have been specified. clone $req->clone; This method returns a clone of the invocant. The clone and the original object can then be changed independent of one another. is_simple This method returns true if and only if all requirements are inclusive minimums -- that is, if their string expression is just the version number. is_finalized This method returns true if the requirements have been finalized by having the "finalize" method called on them. finalize This method marks the requirements finalized. Subsequent attempts to change the requirements will be fatal, *if* they would result in a change. If they would not alter the requirements, they have no effect. If a finalized set of requirements is cloned, the cloned requirements are not also finalized. as_string_hash This returns a reference to a hash describing the requirements using the strings in the META.yml specification. For example after the following program: my $req = CPAN::Meta::Requirements->new; $req->add_minimum('CPAN::Meta::Requirements' => 0.102); $req->add_minimum('Library::Foo' => 1.208); $req->add_maximum('Library::Foo' => 2.602); $req->add_minimum('Module::Bar' => 'v1.2.3'); $req->add_exclusion('Module::Bar' => 'v1.2.8'); $req->exact_version('Xyzzy' => '6.01'); my $hashref = $req->as_string_hash; $hashref would contain: { 'CPAN::Meta::Requirements' => '0.102', 'Library::Foo' => '>= 1.208, <= 2.206', 'Module::Bar' => '>= v1.2.3, != v1.2.8', 'Xyzzy' => '== 6.01', } add_string_requirement $req->add_string_requirement('Library::Foo' => '>= 1.208, <= 2.206'); This method parses the passed in string and adds the appropriate requirement for the given module. It understands version ranges as described in the "Version Ranges" in CPAN::Meta::Spec. For example: 1.3 >= 1.3 <= 1.3 == 1.3 != 1.3 > 1.3 < 1.3 >= 1.3, != 1.5, <= 2.0 A version number without an operator is equivalent to specifying a minimum (">="). Extra whitespace is allowed. from_string_hash my $req = CPAN::Meta::Requirements->from_string_hash( \%hash ); 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. 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. 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 AUTHORS * David Golden * Ricardo Signes COPYRIGHT AND LICENSE This software is copyright (c) 2010 by David Golden and Ricardo Signes. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. CPAN-Meta-Requirements-2.125/t/000755 000765 000024 00000000000 12220106647 016306 5ustar00davidstaff000000 000000 CPAN-Meta-Requirements-2.125/xt/000755 000765 000024 00000000000 12220106647 016476 5ustar00davidstaff000000 000000 CPAN-Meta-Requirements-2.125/xt/author/000755 000765 000024 00000000000 12220106647 020000 5ustar00davidstaff000000 000000 CPAN-Meta-Requirements-2.125/xt/release/000755 000765 000024 00000000000 12220106647 020116 5ustar00davidstaff000000 000000 CPAN-Meta-Requirements-2.125/xt/release/distmeta.t000644 000765 000024 00000000217 12220106647 022115 0ustar00davidstaff000000 000000 #!perl use Test::More; eval "use Test::CPAN::Meta"; plan skip_all => "Test::CPAN::Meta required for testing META.yml" if $@; meta_yaml_ok(); CPAN-Meta-Requirements-2.125/xt/release/minimum-version.t000644 000765 000024 00000000266 12220106647 023445 0ustar00davidstaff000000 000000 #!perl use Test::More; eval "use Test::MinimumVersion"; plan skip_all => "Test::MinimumVersion required for testing minimum versions" if $@; all_minimum_version_ok( qq{5.010} ); CPAN-Meta-Requirements-2.125/xt/release/pod-coverage.t000644 000765 000024 00000000527 12220106647 022662 0ustar00davidstaff000000 000000 #!perl use Test::More; eval "use Test::Pod::Coverage 1.08"; plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage" if $@; eval "use Pod::Coverage::TrustPod"; plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage" if $@; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); CPAN-Meta-Requirements-2.125/xt/release/pod-syntax.t000644 000765 000024 00000000212 12220106647 022404 0ustar00davidstaff000000 000000 #!perl use Test::More; eval "use Test::Pod 1.41"; plan skip_all => "Test::Pod 1.41 required for testing POD" if $@; all_pod_files_ok(); CPAN-Meta-Requirements-2.125/xt/release/portability.t000644 000765 000024 00000000332 12220106647 022643 0ustar00davidstaff000000 000000 #!perl use strict; use warnings; use Test::More; eval 'use Test::Portability::Files'; plan skip_all => 'Test::Portability::Files required for testing portability' if $@; options(test_one_dot => 0); run_tests(); CPAN-Meta-Requirements-2.125/xt/release/test-version.t000644 000765 000024 00000000643 12220106647 022750 0ustar00davidstaff000000 000000 use strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::Version 0.002004 BEGIN { eval "use Test::Version; 1;" or die $@; } 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; CPAN-Meta-Requirements-2.125/xt/author/critic.t000644 000765 000024 00000000435 12220106647 021444 0ustar00davidstaff000000 000000 #!perl use strict; use warnings; use Test::More; use English qw(-no_match_vars); eval "use Test::Perl::Critic"; plan skip_all => 'Test::Perl::Critic required to criticise code' if $@; Test::Perl::Critic->import( -profile => "perlcritic.rc" ) if -e "perlcritic.rc"; all_critic_ok(); CPAN-Meta-Requirements-2.125/xt/author/pod-spell.t000644 000765 000024 00000000467 12220106647 022073 0ustar00davidstaff000000 000000 use strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::PodSpelling 2.006001 use Test::Spelling 0.12; use Pod::Wordlist; add_stopwords(); all_pod_files_spelling_ok( qw( bin lib ) ); __DATA__ invocant David Golden dagolden Ricardo Signes rjbs and lib CPAN Meta Requirements CPAN-Meta-Requirements-2.125/t/00-compile.t000644 000765 000024 00000001760 12220106647 020344 0ustar00davidstaff000000 000000 use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.033 use Test::More tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'CPAN/Meta/Requirements.pm' ); # fake home for cpan-testers use File::Temp; local $ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 ); use File::Spec; use IPC::Open3; use IO::Handle; my @warnings; for my $lib (@module_files) { # see L open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my $stderr = IO::Handle->new; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, '-Mblib', '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($? >> 8, 0, "$lib loaded ok"); if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') if $ENV{AUTHOR_TESTING}; CPAN-Meta-Requirements-2.125/t/00-report-prereqs.t000644 000765 000024 00000003111 12220106647 021676 0ustar00davidstaff000000 000000 #!perl use strict; use warnings; use Test::More tests => 1; use ExtUtils::MakeMaker; use File::Spec::Functions; use List::Util qw/max/; my @modules = qw( Carp ExtUtils::MakeMaker File::Spec File::Spec::Functions File::Temp IO::Handle IPC::Open3 List::Util Scalar::Util Test::More perl strict version warnings ); # replace modules with dynamic results from MYMETA.json if we can # (hide CPAN::Meta from prereq scanner) my $cpan_meta = "CPAN::Meta"; if ( -f "MYMETA.json" && eval "require $cpan_meta" ) { ## no critic if ( my $meta = eval { CPAN::Meta->load_file("MYMETA.json") } ) { my $prereqs = $meta->prereqs; delete $prereqs->{develop}; my %uniq = map {$_ => 1} map { keys %$_ } map { values %$_ } values %$prereqs; $uniq{$_} = 1 for @modules; # don't lose any static ones @modules = sort keys %uniq; } } my @reports = [qw/Version Module/]; for my $mod ( @modules ) { next if $mod eq 'perl'; my $file = $mod; $file =~ s{::}{/}g; $file .= ".pm"; my ($prefix) = grep { -e catfile($_, $file) } @INC; if ( $prefix ) { my $ver = MM->parse_version( catfile($prefix, $file) ); $ver = "undef" unless defined $ver; # Newer MM should do this anyway push @reports, [$ver, $mod]; } else { push @reports, ["missing", $mod]; } } if ( @reports ) { my $vl = max map { length $_->[0] } @reports; my $ml = max map { length $_->[1] } @reports; splice @reports, 1, 0, ["-" x $vl, "-" x $ml]; diag "Prerequisite Report:\n", map {sprintf(" %*s %*s\n",$vl,$_->[0],-$ml,$_->[1])} @reports; } pass; # vim: ts=2 sts=2 sw=2 et: CPAN-Meta-Requirements-2.125/t/accepts.t000644 000765 000024 00000001050 12220106647 020111 0ustar00davidstaff000000 000000 use strict; use warnings; use CPAN::Meta::Requirements; use Test::More 0.88; { my $req = CPAN::Meta::Requirements->new->add_minimum(Foo => 1); ok( $req->accepts_module(Foo => 1)); ok(! $req->accepts_module(Foo => 0)); } { my $req = CPAN::Meta::Requirements->new->add_maximum(Foo => 1); ok( $req->accepts_module(Foo => 1)); ok(! $req->accepts_module(Foo => 2)); } { my $req = CPAN::Meta::Requirements->new->add_exclusion(Foo => 1); ok( $req->accepts_module(Foo => 0)); ok(! $req->accepts_module(Foo => 1)); } done_testing; CPAN-Meta-Requirements-2.125/t/bad_version_hook.t000644 000765 000024 00000001563 12220106647 022013 0ustar00davidstaff000000 000000 use strict; use warnings; use CPAN::Meta::Requirements; use version; use Test::More 0.88; sub dies_ok (&@) { my ($code, $qr, $comment) = @_; my $lived = eval { $code->(); 1 }; if ($lived) { fail("$comment: did not die"); } else { like($@, $qr, $comment); } } sub _fixit { return version->new(42) } { my $req = CPAN::Meta::Requirements->new( {bad_version_hook => \&_fixit} ); $req->add_minimum('Foo::Bar' => 10); $req->add_minimum('Foo::Baz' => 'invalid_version'); is_deeply( $req->as_string_hash, { 'Foo::Bar' => 10, 'Foo::Baz' => 42, }, "hook fixes invalid version", ); } { my $req = CPAN::Meta::Requirements->new( {bad_version_hook => sub { 0 }} ); dies_ok { $req->add_minimum('Foo::Baz' => 'invalid_version') } qr/Invalid version/, "dies if hook doesn't return version object"; } done_testing; CPAN-Meta-Requirements-2.125/t/basic.t000644 000765 000024 00000011473 12220106647 017562 0ustar00davidstaff000000 000000 use strict; use warnings; use CPAN::Meta::Requirements; use Test::More 0.88; sub dies_ok (&@) { my ($code, $qr, $comment) = @_; my $lived = eval { $code->(); 1 }; if ($lived) { fail("$comment: did not die"); } else { like($@, $qr, $comment); } } { my $req = CPAN::Meta::Requirements->new; $req->add_minimum('Foo::Bar' => 10); $req->add_minimum('Foo::Bar' => 0); $req->add_minimum('Foo::Bar' => 2); $req->add_minimum('Foo::Baz' => version->declare('v1.2.3')); $req->add_minimum('Foo::Undef' => undef); is_deeply( $req->as_string_hash, { 'Foo::Bar' => 10, 'Foo::Baz' => 'v1.2.3', 'Foo::Undef' => 0, }, "some basic minimums", ); ok($req->is_simple, "just minimums? simple"); } { my $req = CPAN::Meta::Requirements->new; $req->add_maximum(Foo => 1); is_deeply($req->as_string_hash, { Foo => '<= 1' }, "max only"); ok(! $req->is_simple, "maximums? not simple"); } { my $req = CPAN::Meta::Requirements->new; $req->add_exclusion(Foo => 1); $req->add_exclusion(Foo => 2); # Why would you ever do this?? -- rjbs, 2010-02-20 is_deeply($req->as_string_hash, { Foo => '!= 1, != 2' }, "excl only"); } { my $req = CPAN::Meta::Requirements->new; $req->add_minimum(Foo => 1); $req->add_maximum(Foo => 2); is_deeply( $req->as_string_hash, { Foo => '>= 1, <= 2', }, "min and max", ); $req->add_maximum(Foo => 3); is_deeply( $req->as_string_hash, { Foo => '>= 1, <= 2', }, "exclusions already outside range do not matter", ); $req->add_exclusion(Foo => 1.5); is_deeply( $req->as_string_hash, { Foo => '>= 1, <= 2, != 1.5', }, "exclusions", ); $req->add_minimum(Foo => 1.6); is_deeply( $req->as_string_hash, { Foo => '>= 1.6, <= 2', }, "exclusions go away when made irrelevant", ); } { my $req = CPAN::Meta::Requirements->new; $req->add_minimum(Foo => 1); $req->add_exclusion(Foo => 1); $req->add_maximum(Foo => 2); is_deeply( $req->as_string_hash, { Foo => '> 1, <= 2', }, "we can exclude an endpoint", ); } { my $req = CPAN::Meta::Requirements->new; $req->add_minimum(Foo => 1); $req->add_exclusion(Foo => 1); dies_ok { $req->add_maximum(Foo => 1); } qr/excluded all/, "can't exclude all values" ; } { my $req = CPAN::Meta::Requirements->new; $req->add_minimum(Foo => 1); dies_ok {$req->exact_version(Foo => 0.5); } qr/outside of range/, "can't add outside-range exact spec to range"; } { my $req = CPAN::Meta::Requirements->new; $req->add_minimum(Foo => 1); dies_ok { $req->add_maximum(Foo => 0.5); } qr/minimum 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/, "maximum must exceed (or equal) minimum"; } { my $req = CPAN::Meta::Requirements->new; $req->add_minimum(Foo => 1); $req->add_maximum(Foo => 1); $req->add_maximum(Foo => 2); # ignored $req->add_minimum(Foo => 0); # ignored $req->add_exclusion(Foo => .5); # ignored is_deeply( $req->as_string_hash, { 'Foo' => '== 1', }, "if min==max, becomes exact requirement", ); } { my $req = CPAN::Meta::Requirements->new; $req->add_minimum(Foo => 1); $req->add_exclusion(Foo => 0); $req->add_maximum(Foo => 3); $req->add_exclusion(Foo => 4); $req->add_exclusion(Foo => 2); $req->add_exclusion(Foo => 2); is_deeply( $req->as_string_hash, { Foo => '>= 1, <= 3, != 2', }, 'test exclusion-skipping', ); } sub foo_1 { my $req = CPAN::Meta::Requirements->new; $req->exact_version(Foo => 1); return $req; } { my $req = foo_1; $req->exact_version(Foo => 1); # ignored is_deeply($req->as_string_hash, { Foo => '== 1' }, "exact requirement"); dies_ok { $req->exact_version(Foo => 2); } qr/unequal/, "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"; $req = foo_1; dies_ok { $req->add_minimum(Foo => 2); } qr/minimum above/, "min > fixed"; $req = foo_1; $req->add_exclusion(Foo => 8); # ignored dies_ok { $req->add_exclusion(Foo => 1); } qr/excluded exact/, "!= && =="; } { my $req = foo_1; is($req->requirements_for_module('Foo'), '== 1', 'requirements_for_module'); # test empty/undef returns my @list = $req->requirements_for_module('FooBarBamBaz'); my $scalar = $req->requirements_for_module('FooBarBamBaz'); is ( scalar @list, 0, "requirements_for_module() returns empty for not found (list)" ); is ( $scalar, undef, "requirements_for_module() returns undef for not found (scalar)" ); } done_testing; CPAN-Meta-Requirements-2.125/t/finalize.t000644 000765 000024 00000003461 12220106647 020300 0ustar00davidstaff000000 000000 use strict; use warnings; use CPAN::Meta::Requirements; use Test::More 0.88; sub dies_ok (&@) { my ($code, $qr, $comment) = @_; my $lived = eval { $code->(); 1 }; if ($lived) { fail("$comment: did not die"); } else { like($@, $qr, $comment); } } { my $req = CPAN::Meta::Requirements->new; $req->add_minimum('Foo::Bar' => 10); $req->add_minimum('Foo::Bar' => 0); $req->add_minimum('Foo::Bar' => 2); $req->add_minimum('Foo::Baz' => version->declare('v1.2.3')); $req->add_minimum('Foo::Undef' => undef); my $want = { 'Foo::Bar' => 10, 'Foo::Baz' => 'v1.2.3', 'Foo::Undef' => 0, }; is_deeply( $req->as_string_hash, $want, "some basic minimums", ); $req->finalize; $req->add_minimum('Foo::Bar', 2); pass('we can add a Foo::Bar requirement with no effect post finalization'); dies_ok { $req->add_minimum('Foo::Bar', 12) } qr{finalized req}, "can't add a higher Foo::Bar after finalization"; dies_ok { $req->add_minimum('Foo::New', 0) } qr{finalized req}, "can't add a new module prereq after finalization"; dies_ok { $req->clear_requirement('Foo::Bar') } qr{finalized req}, "can't clear an existing prereq after finalization"; $req->clear_requirement('Bogus::Req'); pass('we can clear a prereq that was not set to begin with'); is_deeply( $req->as_string_hash, $want, "none of our attempts to alter the object post-finalization worked", ); my $cloned = $req->clone; $cloned->add_minimum('Foo::Bar', 12); is_deeply( $cloned->as_string_hash, { %$want, 'Foo::Bar' => 12, }, "we can alter a cloned V:R (finalization does not survive cloning)", ); is_deeply( $req->as_string_hash, $want, "...and original requirements are untouched", ); } done_testing; CPAN-Meta-Requirements-2.125/t/from-hash.t000644 000765 000024 00000002275 12220106647 020365 0ustar00davidstaff000000 000000 use strict; use warnings; use CPAN::Meta::Requirements; use Test::More 0.88; sub dies_ok (&@) { my ($code, $qr, $comment) = @_; my $lived = eval { $code->(); 1 }; if ($lived) { fail("$comment: did not die"); } else { like($@, $qr, $comment); } } { my $string_hash = { Left => 10, Shared => '>= 2, <= 9, != 7', Right => 18, }; my $req = CPAN::Meta::Requirements->from_string_hash($string_hash); is_deeply( $req->as_string_hash, $string_hash, "we can load from a string hash", ); } { my $string_hash = { Left => 10, Shared => '= 2', Right => 18, }; dies_ok { CPAN::Meta::Requirements->from_string_hash($string_hash) } qr/Can't convert/, "we die when we can't understand a version spec"; } { my $string_hash = { Left => 10, Shared => undef, Right => 18, }; my $warning; local $SIG{__WARN__} = sub { $warning = join("\n",@_) }; my $req = CPAN::Meta::Requirements->from_string_hash($string_hash); is( $req->as_string_hash->{Shared}, 0, "undef requirement treated as '0'", ); like ($warning, qr/Undefined requirement.*treated as '0'/, "undef requirement warns"); } done_testing; CPAN-Meta-Requirements-2.125/t/merge.t000644 000765 000024 00000005041 12220106647 017572 0ustar00davidstaff000000 000000 use strict; use warnings; use CPAN::Meta::Requirements; use Test::More 0.88; sub dies_ok (&@) { my ($code, $qr, $comment) = @_; my $lived = eval { $code->(); 1 }; if ($lived) { fail("$comment: did not die"); } else { like($@, $qr, $comment); } } { my $req_1 = CPAN::Meta::Requirements->new; $req_1->add_minimum(Left => 10); $req_1->add_minimum(Shared => 2); $req_1->add_exclusion(Shared => 7); my $req_2 = CPAN::Meta::Requirements->new; $req_2->add_minimum(Shared => 1); $req_2->add_maximum(Shared => 9); $req_2->add_minimum(Right => 18); $req_1->add_requirements($req_2); is_deeply( $req_1->as_string_hash, { Left => 10, Shared => '>= 2, <= 9, != 7', Right => 18, }, "add requirements to an existing set of requirements", ); } { my $req_1 = CPAN::Meta::Requirements->new; $req_1->add_minimum(Left => 10); $req_1->add_minimum(Shared => 2); $req_1->add_exclusion(Shared => 7); $req_1->exact_version(Exact => 8); my $req_2 = CPAN::Meta::Requirements->new; $req_2->add_minimum(Shared => 1); $req_2->add_maximum(Shared => 9); $req_2->add_minimum(Right => 18); $req_2->exact_version(Exact => 8); my $clone = $req_1->clone->add_requirements($req_2); is_deeply( $req_1->as_string_hash, { Left => 10, Shared => '>= 2, != 7', Exact => '== 8', }, "clone/add_requirements does not affect lhs", ); is_deeply( $req_2->as_string_hash, { Shared => '>= 1, <= 9', Right => 18, Exact => '== 8', }, "clone/add_requirements does not affect rhs", ); is_deeply( $clone->as_string_hash, { Left => 10, Shared => '>= 2, <= 9, != 7', Right => 18, Exact => '== 8', }, "clone and add_requirements", ); $clone->clear_requirement('Shared'); is_deeply( $clone->as_string_hash, { Left => 10, Right => 18, Exact => '== 8', }, "cleared the shared requirement", ); } { my $req_1 = CPAN::Meta::Requirements->new; $req_1->add_maximum(Foo => 1); my $req_2 = $req_1->clone; is_deeply( $req_2->as_string_hash, { 'Foo' => '<= 1', }, 'clone with only max', ); } { my $left = CPAN::Meta::Requirements->new; $left->add_minimum(Foo => 0); $left->add_minimum(Bar => 1); my $right = CPAN::Meta::Requirements->new; $right->add_requirements($left); is_deeply( $right->as_string_hash, { Foo => 0, Bar => 1, }, "we do not lose 0-min reqs on merge", ); } done_testing; CPAN-Meta-Requirements-2.125/lib/CPAN/000755 000765 000024 00000000000 12220106647 017332 5ustar00davidstaff000000 000000 CPAN-Meta-Requirements-2.125/lib/CPAN/Meta/000755 000765 000024 00000000000 12220106647 020220 5ustar00davidstaff000000 000000 CPAN-Meta-Requirements-2.125/lib/CPAN/Meta/Requirements.pm000644 000765 000024 00000042465 12220106647 023254 0ustar00davidstaff000000 000000 use strict; use warnings; package CPAN::Meta::Requirements; our $VERSION = '2.125'; # VERSION # ABSTRACT: a set of version requirements for a CPAN dist use Carp (); use Scalar::Util (); use version 0.77 (); # the ->parse method my @valid_options = qw( bad_version_hook ); sub new { my ($class, $options) = @_; $options ||= {}; Carp::croak "Argument to $class\->new() must be a hash reference" unless ref $options eq 'HASH'; my %self = map {; $_ => $options->{$_}} @valid_options; return bless \%self => $class; } sub _version_object { my ($self, $version) = @_; my $vobj; eval { $vobj = (! defined $version) ? version->parse(0) : (! Scalar::Util::blessed($version)) ? version->parse($version) : $version; }; if ( my $err = $@ ) { my $hook = $self->{bad_version_hook}; $vobj = eval { $hook->($version) } if ref $hook eq 'CODE'; unless (Scalar::Util::blessed($vobj) && $vobj->isa("version")) { $err =~ s{ at .* line \d+.*$}{}; die "Can't convert '$version': $err"; } } # ensure no leading '.' if ( $vobj =~ m{\A\.} ) { $vobj = version->parse("0$vobj"); } # ensure normal v-string form if ( $vobj->is_qv ) { $vobj = version->parse($vobj->normal); } return $vobj; } BEGIN { for my $type (qw(minimum maximum exclusion exact_version)) { my $method = "with_$type"; my $to_add = $type eq 'exact_version' ? $type : "add_$type"; my $code = sub { my ($self, $name, $version) = @_; $version = $self->_version_object( $version ); $self->__modify_entry_for($name, $method, $version); return $self; }; no strict 'refs'; *$to_add = $code; } } sub add_requirements { my ($self, $req) = @_; for my $module ($req->required_modules) { my $modifiers = $req->__entry_for($module)->as_modifiers; for my $modifier (@$modifiers) { my ($method, @args) = @$modifier; $self->$method($module => @args); }; } return $self; } sub accepts_module { my ($self, $module, $version) = @_; $version = $self->_version_object( $version ); return 1 unless my $range = $self->__entry_for($module); return $range->_accepts($version); } sub clear_requirement { my ($self, $module) = @_; return $self unless $self->__entry_for($module); Carp::confess("can't clear requirements on finalized requirements") if $self->is_finalized; delete $self->{requirements}{ $module }; return $self; } sub requirements_for_module { my ($self, $module) = @_; my $entry = $self->__entry_for($module); return unless $entry; return $entry->as_string; } sub required_modules { keys %{ $_[0]{requirements} } } sub clone { my ($self) = @_; my $new = (ref $self)->new; return $new->add_requirements($self); } sub __entry_for { $_[0]{requirements}{ $_[1] } } sub __modify_entry_for { my ($self, $name, $method, $version) = @_; my $fin = $self->is_finalized; my $old = $self->__entry_for($name); Carp::confess("can't add new requirements to finalized requirements") if $fin and not $old; my $new = ($old || 'CPAN::Meta::Requirements::_Range::Range') ->$method($version); Carp::confess("can't modify finalized requirements") if $fin and $old->as_string ne $new->as_string; $self->{requirements}{ $name } = $new; } sub is_simple { my ($self) = @_; for my $module ($self->required_modules) { # XXX: This is a complete hack, but also entirely correct. return if $self->__entry_for($module)->as_string =~ /\s/; } return 1; } sub is_finalized { $_[0]{finalized} } sub finalize { $_[0]{finalized} = 1 } sub as_string_hash { my ($self) = @_; my %hash = map {; $_ => $self->{requirements}{$_}->as_string } $self->required_modules; return \%hash; } my %methods_for_op = ( '==' => [ qw(exact_version) ], '!=' => [ qw(add_exclusion) ], '>=' => [ qw(add_minimum) ], '<=' => [ qw(add_maximum) ], '>' => [ qw(add_minimum add_exclusion) ], '<' => [ qw(add_maximum add_exclusion) ], ); sub add_string_requirement { my ($self, $module, $req) = @_; Carp::confess("No requirement string provided for $module") unless defined $req && length $req; my @parts = split qr{\s*,\s*}, $req; for my $part (@parts) { my ($op, $ver) = $part =~ m{\A\s*(==|>=|>|<=|<|!=)\s*(.*)\z}; if (! defined $op) { $self->add_minimum($module => $part); } else { Carp::confess("illegal requirement string: $req") unless my $methods = $methods_for_op{ $op }; $self->$_($module => $ver) for @$methods; } } } sub from_string_hash { my ($class, $hash) = @_; my $self = $class->new; for my $module (keys %$hash) { my $req = $hash->{$module}; unless ( defined $req && length $req ) { $req = 0; Carp::carp("Undefined requirement for $module treated as '0'"); } $self->add_string_requirement($module, $req); } return $self; } ############################################################## { package CPAN::Meta::Requirements::_Range::Exact; sub _new { bless { version => $_[1] } => $_[0] } sub _accepts { return $_[0]{version} == $_[1] } sub as_string { return "== $_[0]{version}" } sub as_modifiers { return [ [ exact_version => $_[0]{version} ] ] } sub _clone { (ref $_[0])->_new( version->new( $_[0]{version} ) ) } sub with_exact_version { my ($self, $version) = @_; return $self->_clone if $self->_accepts($version); Carp::confess("illegal requirements: unequal exact version specified"); } sub with_minimum { my ($self, $minimum) = @_; return $self->_clone if $self->{version} >= $minimum; Carp::confess("illegal requirements: minimum above exact specification"); } sub with_maximum { my ($self, $maximum) = @_; return $self->_clone if $self->{version} <= $maximum; Carp::confess("illegal requirements: maximum below exact specification"); } sub with_exclusion { my ($self, $exclusion) = @_; return $self->_clone unless $exclusion == $self->{version}; Carp::confess("illegal requirements: excluded exact specification"); } } ############################################################## { package CPAN::Meta::Requirements::_Range::Range; sub _self { ref($_[0]) ? $_[0] : (bless { } => $_[0]) } sub _clone { return (bless { } => $_[0]) unless ref $_[0]; my ($s) = @_; my %guts = ( (exists $s->{minimum} ? (minimum => version->new($s->{minimum})) : ()), (exists $s->{maximum} ? (maximum => version->new($s->{maximum})) : ()), (exists $s->{exclusions} ? (exclusions => [ map { version->new($_) } @{ $s->{exclusions} } ]) : ()), ); bless \%guts => ref($s); } sub as_modifiers { my ($self) = @_; my @mods; push @mods, [ add_minimum => $self->{minimum} ] if exists $self->{minimum}; push @mods, [ add_maximum => $self->{maximum} ] if exists $self->{maximum}; push @mods, map {; [ add_exclusion => $_ ] } @{$self->{exclusions} || []}; return \@mods; } sub as_string { 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 ( [ qw( >= > minimum ) ], [ qw( <= < maximum ) ], ) { my ($op, $e_op, $k) = @$pair; if (exists $self->{$k}) { my @new_exclusions = grep { $_ != $self->{ $k } } @exclusions; if (@new_exclusions == @exclusions) { push @parts, "$op $self->{ $k }"; } else { push @parts, "$e_op $self->{ $k }"; @exclusions = @new_exclusions; } } } push @parts, map {; "!= $_" } @exclusions; return join q{, }, @parts; } sub with_exact_version { my ($self, $version) = @_; $self = $self->_clone; Carp::confess("illegal requirements: exact specification outside of range") unless $self->_accepts($version); return CPAN::Meta::Requirements::_Range::Exact->_new($version); } sub _simplify { my ($self) = @_; 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} || [] }; return CPAN::Meta::Requirements::_Range::Exact->_new($self->{minimum}) } Carp::confess("illegal requirements: minimum exceeds maximum") if $self->{minimum} > $self->{maximum}; } # eliminate irrelevant exclusions if ($self->{exclusions}) { my %seen; @{ $self->{exclusions} } = grep { (! defined $self->{minimum} or $_ >= $self->{minimum}) and (! defined $self->{maximum} or $_ <= $self->{maximum}) and ! $seen{$_}++ } @{ $self->{exclusions} }; } return $self; } sub with_minimum { my ($self, $minimum) = @_; $self = $self->_clone; if (defined (my $old_min = $self->{minimum})) { $self->{minimum} = (sort { $b cmp $a } ($minimum, $old_min))[0]; } else { $self->{minimum} = $minimum; } return $self->_simplify; } sub with_maximum { my ($self, $maximum) = @_; $self = $self->_clone; if (defined (my $old_max = $self->{maximum})) { $self->{maximum} = (sort { $a cmp $b } ($maximum, $old_max))[0]; } else { $self->{maximum} = $maximum; } return $self->_simplify; } sub with_exclusion { my ($self, $exclusion) = @_; $self = $self->_clone; push @{ $self->{exclusions} ||= [] }, $exclusion; return $self->_simplify; } sub _accepts { my ($self, $version) = @_; return if defined $self->{minimum} and $version < $self->{minimum}; return if defined $self->{maximum} and $version > $self->{maximum}; return if defined $self->{exclusions} and grep { $version == $_ } @{ $self->{exclusions} }; return 1; } } 1; # vim: ts=2 sts=2 sw=2 et: __END__ =pod =encoding utf-8 =head1 NAME CPAN::Meta::Requirements - a set of version requirements for a CPAN dist =head1 VERSION version 2.125 =head1 SYNOPSIS use CPAN::Meta::Requirements; my $build_requires = CPAN::Meta::Requirements->new; $build_requires->add_minimum('Library::Foo' => 1.208); $build_requires->add_minimum('Library::Foo' => 2.602); $build_requires->add_minimum('Module::Bar' => 'v1.2.3'); $METAyml->{build_requires} = $build_requires->as_string_hash; =head1 DESCRIPTION A CPAN::Meta::Requirements object models a set of version constraints like those specified in the F or F files in CPAN distributions. It can be built up by adding more and more constraints, and it will reduce them to the simplest representation. Logically impossible constraints will be identified immediately by thrown exceptions. =head1 METHODS =head2 new my $req = CPAN::Meta::Requirements->new; This returns a new CPAN::Meta::Requirements object. It takes an optional hash reference argument. The following keys are supported: =over 4 =item * -- if provided, when a version cannot be parsed into a version object, this code reference will be called with the invalid version string as an argument. It must return a valid version object. =back All other keys are ignored. =head2 add_minimum $req->add_minimum( $module => $version ); This adds a new minimum version requirement. If the new requirement is redundant to the existing specification, this has no effect. Minimum requirements are inclusive. C<$version> is required, along with any greater version number. This method returns the requirements object. =head2 add_maximum $req->add_maximum( $module => $version ); This adds a new maximum version requirement. If the new requirement is redundant to the existing specification, this has no effect. Maximum requirements are inclusive. No version strictly greater than the given version is allowed. This method returns the requirements object. =head2 add_exclusion $req->add_exclusion( $module => $version ); This adds a new excluded version. For example, you might use these three method calls: $req->add_minimum( $module => '1.00' ); $req->add_maximum( $module => '1.82' ); $req->add_exclusion( $module => '1.75' ); Any version between 1.00 and 1.82 inclusive would be acceptable, except for 1.75. This method returns the requirements object. =head2 exact_version $req->exact_version( $module => $version ); This sets the version required for the given module to I the given version. No other version would be considered acceptable. This method returns the requirements object. =head2 add_requirements $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 returns the requirements object. =head2 accepts_module my $bool = $req->accepts_modules($module => $version); Given an module and version, this method returns true if the version specification for the module accepts the provided version. In other words, given: Module => '>= 1.00, < 2.00' We will accept 1.00 and 1.75 but not 0.50 or 2.00. For modules that do not appear in the requirements, this method will return true. =head2 clear_requirement $req->clear_requirement( $module ); This removes the requirement for a given module from the object. This method returns the requirements object. =head2 requirements_for_module $req->requirements_for_module( $module ); This returns a string containing the version requirements for a given module in 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.) =head2 required_modules This method returns a list of all the modules for which requirements have been specified. =head2 clone $req->clone; This method returns a clone of the invocant. The clone and the original object can then be changed independent of one another. =head2 is_simple This method returns true if and only if all requirements are inclusive minimums -- that is, if their string expression is just the version number. =head2 is_finalized This method returns true if the requirements have been finalized by having the C method called on them. =head2 finalize This method marks the requirements finalized. Subsequent attempts to change the requirements will be fatal, I they would result in a change. If they would not alter the requirements, they have no effect. If a finalized set of requirements is cloned, the cloned requirements are not also finalized. =head2 as_string_hash This returns a reference to a hash describing the requirements using the strings in the F specification. For example after the following program: my $req = CPAN::Meta::Requirements->new; $req->add_minimum('CPAN::Meta::Requirements' => 0.102); $req->add_minimum('Library::Foo' => 1.208); $req->add_maximum('Library::Foo' => 2.602); $req->add_minimum('Module::Bar' => 'v1.2.3'); $req->add_exclusion('Module::Bar' => 'v1.2.8'); $req->exact_version('Xyzzy' => '6.01'); my $hashref = $req->as_string_hash; C<$hashref> would contain: { 'CPAN::Meta::Requirements' => '0.102', 'Library::Foo' => '>= 1.208, <= 2.206', 'Module::Bar' => '>= v1.2.3, != v1.2.8', 'Xyzzy' => '== 6.01', } =head2 add_string_requirement $req->add_string_requirement('Library::Foo' => '>= 1.208, <= 2.206'); 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. For example: =over 4 =item 1.3 =item >= 1.3 =item <= 1.3 =item == 1.3 =item != 1.3 =item > 1.3 =item < 1.3 =item >= 1.3, != 1.5, <= 2.0 A version number without an operator is equivalent to specifying a minimum (C=>). Extra whitespace is allowed. =back =head2 from_string_hash my $req = CPAN::Meta::Requirements->from_string_hash( \%hash ); 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. =for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan =head1 SUPPORT =head2 Bugs / Feature Requests Please report any bugs or feature requests through the issue tracker at L. You will be notified automatically of any progress on your issue. =head2 Source Code This is open source software. The code repository is available for public review and contribution under the terms of the license. L git clone https://github.com/dagolden/CPAN-Meta-Requirements.git =head1 AUTHORS =over 4 =item * David Golden =item * Ricardo Signes =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2010 by David Golden and Ricardo Signes. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut