From 4fdfb4507f4a48e073e551f4aead0ce9ad435bee Mon Sep 17 00:00:00 2001 From: Packit Date: Sep 16 2020 12:43:53 +0000 Subject: perl-inc-latest-0.500 base --- diff --git a/CONTRIBUTING.mkdn b/CONTRIBUTING.mkdn new file mode 100644 index 0000000..761c9db --- /dev/null +++ b/CONTRIBUTING.mkdn @@ -0,0 +1,87 @@ +## 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, as is much of the documentation. Some generated files are +kept in the repository as a convenience (e.g. Makefile.PL or cpanfile). + +Generally, **you do not need Dist::Zilla to contribute patches**. You do need +Dist::Zilla to create a tarball. See below for guidance. + +### Getting dependencies + +If you have App::cpanminus 1.6 or later installed, you can use `cpanm` to +satisfy dependencies like this: + + $ cpanm --installdeps . + +Otherwise, look for either a `Makefile.PL` or `cpanfile` file for +a list of dependencies to satisfy. + +### Running tests + +You can run tests directly using the `prove` tool: + + $ prove -l + $ prove -lv t/some_test_file.t + +For most of my distributions, `prove` is entirely sufficient for you to test any +patches you have. I use `prove` for 99% of my testing during development. + +### 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. Some is +generated boilerplate; other documentation is built from pseudo-POD +directives in the source like C<=method> or C<=func>. + +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. + +### Installing and using Dist::Zilla + +Dist::Zilla is a very powerful authoring tool, optimized for maintaining a +large number of distributions with a high degree of automation, but it has a +large dependency chain, a bit of a learning curve and requires a number of +author-specific plugins. + +To install it from CPAN, I recommend one of the following approaches for +the quickest installation: + + # using CPAN.pm, but bypassing non-functional pod tests + $ cpan TAP::Harness::Restricted + $ PERL_MM_USE_DEFAULT=1 HARNESS_CLASS=TAP::Harness::Restricted cpan Dist::Zilla + + # using cpanm, bypassing *all* tests + $ cpanm -n Dist::Zilla + +In either case, it's probably going to take about 10 minutes. Go for a walk, +go get a cup of your favorite beverage, take a bathroom break, or whatever. +When you get back, Dist::Zilla should be ready for you. + +Then you need to install any plugins specific to this distribution: + + $ 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/ + diff --git a/Changes b/Changes new file mode 100644 index 0000000..9b853a0 --- /dev/null +++ b/Changes @@ -0,0 +1,6 @@ +Revision history for inc-latest + +0.500 2014-12-05 23:43:12-05:00 America/New_York + + - Split out from Module::Build into an independent package + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ff0126d --- /dev/null +++ b/LICENSE @@ -0,0 +1,207 @@ +This software is Copyright (c) 2009 by David Golden. + +This is free software, licensed under: + + The Apache License, Version 2.0, January 2004 + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..7ff5f51 --- /dev/null +++ b/MANIFEST @@ -0,0 +1,26 @@ +# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.025. +CONTRIBUTING.mkdn +Changes +LICENSE +MANIFEST +META.json +META.yml +Makefile.PL +README +cpanfile +dist.ini +lib/inc/latest.pm +lib/inc/latest/private.pm +perlcritic.rc +t/00-report-prereqs.dd +t/00-report-prereqs.t +tidyall.ini +xt/author/00-compile.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 diff --git a/META.json b/META.json new file mode 100644 index 0000000..0e2fcd9 --- /dev/null +++ b/META.json @@ -0,0 +1,105 @@ +{ + "abstract" : "use modules bundled in inc/ if they are newer than installed ones", + "author" : [ + "David Golden ", + "Eric Wilhelm " + ], + "dynamic_config" : 0, + "generated_by" : "Dist::Zilla version 5.025, CPAN::Meta::Converter version 2.142690", + "license" : [ + "apache_2_0" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : "2" + }, + "name" : "inc-latest", + "no_index" : { + "directory" : [ + "t", + "xt", + "examples", + "corpus" + ], + "package" : [ + "DB" + ] + }, + "prereqs" : { + "configure" : { + "requires" : { + "ExtUtils::MakeMaker" : "6.17", + "perl" : "5.006" + } + }, + "develop" : { + "requires" : { + "Dist::Zilla" : "5", + "Dist::Zilla::Plugin::SurgicalPodWeaver" : "0.0021", + "Dist::Zilla::PluginBundle::DAGOLDEN" : "0.072", + "File::Spec" : "0", + "File::Temp" : "0", + "IO::Handle" : "0", + "IPC::Open3" : "0", + "Pod::Coverage::TrustPod" : "0", + "Test::CPAN::Meta" : "0", + "Test::More" : "0", + "Test::Pod" : "1.41", + "Test::Pod::Coverage" : "1.08", + "Test::Spelling" : "0.12", + "Test::Version" : "1" + } + }, + "runtime" : { + "requires" : { + "Carp" : "0", + "ExtUtils::Installed" : "0", + "ExtUtils::MakeMaker" : "0", + "File::Basename" : "0", + "File::Copy" : "0", + "File::Path" : "0", + "File::Spec" : "0", + "IO::File" : "0", + "perl" : "5.006", + "strict" : "0", + "warnings" : "0" + } + }, + "test" : { + "recommends" : { + "CPAN::Meta" : "2.120900" + }, + "requires" : { + "ExtUtils::MakeMaker" : "0", + "File::Spec" : "0", + "Test::More" : "0", + "perl" : "5.006" + } + } + }, + "provides" : { + "inc::latest" : { + "file" : "lib/inc/latest.pm", + "version" : "0.500" + }, + "inc::latest::private" : { + "file" : "lib/inc/latest/private.pm", + "version" : "0.500" + } + }, + "release_status" : "stable", + "resources" : { + "bugtracker" : { + "web" : "https://github.com/dagolden/inc-latest/issues" + }, + "homepage" : "https://github.com/dagolden/inc-latest", + "repository" : { + "type" : "git", + "url" : "https://github.com/dagolden/inc-latest.git", + "web" : "https://github.com/dagolden/inc-latest" + } + }, + "version" : "0.500", + "x_authority" : "cpan:DAGOLDEN" +} + diff --git a/META.yml b/META.yml new file mode 100644 index 0000000..9823d53 --- /dev/null +++ b/META.yml @@ -0,0 +1,53 @@ +--- +abstract: 'use modules bundled in inc/ if they are newer than installed ones' +author: + - 'David Golden ' + - 'Eric Wilhelm ' +build_requires: + ExtUtils::MakeMaker: '0' + File::Spec: '0' + Test::More: '0' + perl: '5.006' +configure_requires: + ExtUtils::MakeMaker: '6.17' + perl: '5.006' +dynamic_config: 0 +generated_by: 'Dist::Zilla version 5.025, CPAN::Meta::Converter version 2.142690' +license: apache +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: '1.4' +name: inc-latest +no_index: + directory: + - t + - xt + - examples + - corpus + package: + - DB +provides: + inc::latest: + file: lib/inc/latest.pm + version: '0.500' + inc::latest::private: + file: lib/inc/latest/private.pm + version: '0.500' +requires: + Carp: '0' + ExtUtils::Installed: '0' + ExtUtils::MakeMaker: '0' + File::Basename: '0' + File::Copy: '0' + File::Path: '0' + File::Spec: '0' + IO::File: '0' + perl: '5.006' + strict: '0' + warnings: '0' +resources: + bugtracker: https://github.com/dagolden/inc-latest/issues + homepage: https://github.com/dagolden/inc-latest + repository: https://github.com/dagolden/inc-latest.git +version: '0.500' +x_authority: cpan:DAGOLDEN diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..e0041f4 --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,74 @@ + +# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.025. +use strict; +use warnings; + +use 5.006; + +use ExtUtils::MakeMaker 6.17; + + + +my %WriteMakefileArgs = ( + "ABSTRACT" => "use modules bundled in inc/ if they are newer than installed ones", + "AUTHOR" => "David Golden , Eric Wilhelm ", + "CONFIGURE_REQUIRES" => { + "ExtUtils::MakeMaker" => "6.17" + }, + "DISTNAME" => "inc-latest", + "EXE_FILES" => [], + "LICENSE" => "apache", + "MIN_PERL_VERSION" => "5.006", + "NAME" => "inc::latest", + "PREREQ_PM" => { + "Carp" => 0, + "ExtUtils::Installed" => 0, + "ExtUtils::MakeMaker" => 0, + "File::Basename" => 0, + "File::Copy" => 0, + "File::Path" => 0, + "File::Spec" => 0, + "IO::File" => 0, + "strict" => 0, + "warnings" => 0 + }, + "TEST_REQUIRES" => { + "ExtUtils::MakeMaker" => 0, + "File::Spec" => 0, + "Test::More" => 0 + }, + "VERSION" => "0.500", + "test" => { + "TESTS" => "t/*.t" + } +); + + +my %FallbackPrereqs = ( + "Carp" => 0, + "ExtUtils::Installed" => 0, + "ExtUtils::MakeMaker" => "6.17", + "File::Basename" => 0, + "File::Copy" => 0, + "File::Path" => 0, + "File::Spec" => 0, + "IO::File" => 0, + "Test::More" => 0, + "strict" => 0, + "warnings" => 0 +); + + +unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { + delete $WriteMakefileArgs{TEST_REQUIRES}; + delete $WriteMakefileArgs{BUILD_REQUIRES}; + $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; +} + +delete $WriteMakefileArgs{CONFIGURE_REQUIRES} + unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; + +WriteMakefile(%WriteMakefileArgs); + + + diff --git a/README b/README new file mode 100644 index 0000000..5709ba8 --- /dev/null +++ b/README @@ -0,0 +1,161 @@ +NAME + inc::latest - use modules bundled in inc/ if they are newer than + installed ones + +VERSION + version 0.500 + +SYNOPSIS + # in Makefile.PL or Build.PL + use inc::latest 'Some::Configure::Prereq'; + +DESCRIPTION + WARNING -- THIS IS AN EXPERIMENTAL MODULE. It was originally bundled (as + an experiment) with Module::Build and has been split out for more + general use. + + The "inc::latest" module helps bootstrap configure-time dependencies for + CPAN distributions. These dependencies get bundled into the "inc" + directory within a distribution and are used by Makefile.PL or Build.PL. + + Arguments to "inc::latest" are module names that are checked against + both the current @INC array and against specially-named directories in + "inc". If the bundled version is newer than the installed one (or the + module isn't installed, then, the bundled directory is added to the + start of @INC and the module is loaded from there. + + There are actually two variations of "inc::latest" -- one for authors + and one for the "inc" directory. For distribution authors, the + "inc::latest" installed in the system will record modules loaded via + "inc::latest" and can be used to create the bundled files in "inc", + including writing the second variation as "inc/latest.pm". + + This second "inc::latest" is the one that is loaded in a distribution + being installed (e.g. from Makefile.PL or Build.PL). This bundled + "inc::latest" is the one that determines which module to load. + + Special notes on bundling + The "inc::latest" module creates bundled directories based on the + packlist file of an installed distribution. Even though "inc::latest" + takes module name arguments, it is better to think of it as bundling and + making available entire *distributions*. When a module is loaded through + "inc::latest", it looks in all bundled distributions in "inc/" for a + newer module than can be found in the existing @INC array. + + Thus, the module-name provided should usually be the "top-level" module + name of a distribution, though this is not strictly required. + "inc::latest" has a number of heuristics to discover module names, + allowing users to do things like this: + + use inc::latest 'Devel::AssertOS::Unix'; + + even though Devel::AssertOS::Unix is contained within the Devel-CheckOS + distribution. + + At the current time, packlists are required. Thus, bundling dual-core + modules may require a 'forced install' over versions in the latest + version of perl in order to create the necessary packlist for bundling. + + Managing dependency chains + Before bundling a distribution you must ensure that all prerequisites + are also bundled and load in the correct order. + + For example, if you need "Wibble", but "Wibble" depends on "Wobble", and + you have bundled "Module::Build", your Build.PL might look like this: + + use inc::latest 'Wobble'; + use inc::latest 'Wibble'; + use inc::latest 'Module::Build'; + + Module::Build->new( + module_name => 'Foo::Bar', + license => 'perl', + )->create_build_script; + + Authors are strongly suggested to limit the bundling of additional + dependencies if at all possible and to carefully test their distribution + tarballs before uploading to CPAN. + +USAGE + As bundled in inc/ + Using "Author-mode", a special stub module will be created in your + distribute directory as inc/latest.pm. In your Makefile.PL or Build.PL, + you can then load "inc::latest" to load bundled modules. + + When calling "use", the bundled "inc::latest" takes a single module name + and optional arguments to pass to that module's own import method. + + use inc::latest 'Foo::Bar' qw/foo bar baz/; + + The implementation is private. Only the "import" method is public. + + Author-mode + When you have inc::latest installed from CPAN, then you are in + author-mode if any of the Author-mode methods are available. For + example: + + if ( inc::latest->can('write') ) { + inc::latest->write('inc'); + } + + Using author-mode, you can create the stub inc/latest.pm and bundle + modules into inc. + + loaded_modules() + my @list = inc::latest->loaded_modules; + + This takes no arguments and always returns a list of module names + requested for loading via "use inc::latest 'MODULE'", regardless of + whether the load was successful or not. + + write() + inc::latest->write( 'inc' ); + + This writes the bundled version of inc::latest to the directory name + given as an argument. It almost all cases, it should be '"inc"'. + + bundle_module() + for my $mod ( inc::latest->loaded_modules ) { + inc::latest->bundle_module($mod, $dir); + } + + If $mod corresponds to a packlist, then this function creates a + specially-named directory in $dir and copies all .pm files from the + modlist to the new directory (which almost always should just be + 'inc'). For example, if Foo::Bar is the name of the module, and $dir + is 'inc', then the directory would be 'inc/inc_Foo-Bar' and contain + files like this: + + inc/inc_Foo-Bar/Foo/Bar.pm + + Currently, $mod must have a packlist. If this is not the case (e.g. + for a dual-core module), then the bundling will fail. You may be + able to create a packlist by forced installing the module on top of + the version that came with core Perl. + +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/inc-latest.git + +AUTHORS + * David Golden + + * Eric Wilhelm + +COPYRIGHT AND LICENSE + This software is Copyright (c) 2009 by David Golden. + + This is free software, licensed under: + + The Apache License, Version 2.0, January 2004 + diff --git a/cpanfile b/cpanfile new file mode 100644 index 0000000..5571732 --- /dev/null +++ b/cpanfile @@ -0,0 +1,44 @@ +requires "Carp" => "0"; +requires "ExtUtils::Installed" => "0"; +requires "ExtUtils::MakeMaker" => "0"; +requires "File::Basename" => "0"; +requires "File::Copy" => "0"; +requires "File::Path" => "0"; +requires "File::Spec" => "0"; +requires "IO::File" => "0"; +requires "perl" => "5.006"; +requires "strict" => "0"; +requires "warnings" => "0"; + +on 'test' => sub { + requires "ExtUtils::MakeMaker" => "0"; + requires "File::Spec" => "0"; + requires "Test::More" => "0"; + requires "perl" => "5.006"; +}; + +on 'test' => sub { + recommends "CPAN::Meta" => "2.120900"; +}; + +on 'configure' => sub { + requires "ExtUtils::MakeMaker" => "6.17"; + requires "perl" => "5.006"; +}; + +on 'develop' => sub { + requires "Dist::Zilla" => "5"; + requires "Dist::Zilla::Plugin::SurgicalPodWeaver" => "0.0021"; + requires "Dist::Zilla::PluginBundle::DAGOLDEN" => "0.072"; + requires "File::Spec" => "0"; + requires "File::Temp" => "0"; + requires "IO::Handle" => "0"; + requires "IPC::Open3" => "0"; + requires "Pod::Coverage::TrustPod" => "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"; +}; diff --git a/dist.ini b/dist.ini new file mode 100644 index 0000000..611a603 --- /dev/null +++ b/dist.ini @@ -0,0 +1,21 @@ +name = inc-latest +author = David Golden +author = Eric Wilhelm +license = Apache_2_0 +copyright_holder = David Golden +copyright_year = 2009 + +[@DAGOLDEN] +:version = 0.072 +-remove = PodWeaver +stopwords = CheckOS +stopwords = Devel +stopwords = modlist +stopwords = packlist +stopwords = packlists + +[SurgicalPodWeaver] +:version = 0.0021 +config_plugin = @DAGOLDEN +replacer = replace_with_comment +post_code_replacer = replace_with_nothing diff --git a/lib/inc/latest.pm b/lib/inc/latest.pm new file mode 100644 index 0000000..705baf2 --- /dev/null +++ b/lib/inc/latest.pm @@ -0,0 +1,319 @@ +use strict; +use warnings; + +package inc::latest; + +# ABSTRACT: use modules bundled in inc/ if they are newer than installed ones + +our $VERSION = '0.500'; + +package inc::latest; + +use Carp; +use File::Basename (); +use File::Spec (); +use File::Path (); +use IO::File (); +use File::Copy (); + +# track and return modules loaded by inc::latest +my @loaded_modules; +sub loaded_modules { @loaded_modules } + +# must ultimately "goto" the import routine of the module to be loaded +# so that the calling package is correct when $mod->import() runs. +sub import { + my ( $package, $mod, @args ) = @_; + return unless ( defined $mod ); + + my $private_path = 'inc/latest/private.pm'; + if ( -e $private_path ) { + # user mode - delegate work to bundled private module + require $private_path; + splice( @_, 0, 1, 'inc::latest::private' ); + goto \&inc::latest::private::import; + } + + # author mode - just record and load the modules + push( @loaded_modules, $mod ); + require inc::latest::private; + goto \&inc::latest::private::_load_module; +} + +sub write { + my $package = shift; + my ( $where, @preload ) = @_; + + warn "should really be writing in inc/" unless $where =~ /inc$/; + + # write inc/latest.pm + File::Path::mkpath($where); + my $fh = IO::File->new( File::Spec->catfile( $where, 'latest.pm' ), "w" ); + print {$fh} "# This stub created by inc::latest $VERSION\n"; + print {$fh} <<'HERE'; +package inc::latest; +use strict; +use vars '@ISA'; +require inc::latest::private; +@ISA = qw/inc::latest::private/; +HERE + if (@preload) { + print {$fh} "\npackage inc::latest::preload;\n"; + for my $mod (@preload) { + print {$fh} "inc::latest->import('$mod');\n"; + } + } + print {$fh} "\n1;\n"; + close $fh; + + # write inc/latest/private; + require inc::latest::private; + File::Path::mkpath( File::Spec->catdir( $where, 'latest' ) ); + my $from = $INC{'inc/latest/private.pm'}; + my $to = File::Spec->catfile( $where, 'latest', 'private.pm' ); + File::Copy::copy( $from, $to ) or die "Couldn't copy '$from' to '$to': $!"; + + return 1; +} + +sub bundle_module { + my ( $package, $module, $where ) = @_; + + # create inc/inc_$foo + ( my $dist = $module ) =~ s{::}{-}g; + my $inc_lib = File::Spec->catdir( $where, "inc_$dist" ); + File::Path::mkpath $inc_lib; + + # get list of files to copy + require ExtUtils::Installed; + # workaround buggy EU::Installed check of @INC + my $inst = ExtUtils::Installed->new( extra_libs => [@INC] ); + my $packlist = $inst->packlist($module) or die "Couldn't find packlist"; + my @files = grep { /\.pm$/ } keys %$packlist; + + # figure out prefix + my $mod_path = quotemeta $package->_mod2path($module); + my ($prefix) = grep { /$mod_path$/ } @files; + $prefix =~ s{$mod_path$}{}; + + # copy files + for my $from (@files) { + next unless $from =~ /\.pm$/; + ( my $mod_path = $from ) =~ s{^\Q$prefix\E}{}; + my $to = File::Spec->catfile( $inc_lib, $mod_path ); + File::Path::mkpath( File::Basename::dirname($to) ); + File::Copy::copy( $from, $to ) or die "Couldn't copy '$from' to '$to': $!"; + } + return 1; +} + +# Translate a module name into a directory/file.pm to search for in @INC +sub _mod2path { + my ( $self, $mod ) = @_; + my @parts = split /::/, $mod; + $parts[-1] .= '.pm'; + return $parts[0] if @parts == 1; + return File::Spec->catfile(@parts); +} + +1; + + +# vim: ts=4 sts=4 sw=4 tw=75 et: + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +inc::latest - use modules bundled in inc/ if they are newer than installed ones + +=head1 VERSION + +version 0.500 + +=head1 SYNOPSIS + + # in Makefile.PL or Build.PL + use inc::latest 'Some::Configure::Prereq'; + +=head1 DESCRIPTION + +B. It was originally bundled +(as an experiment) with L and has been split out for more +general use. + +The C module helps bootstrap configure-time dependencies for +CPAN distributions. These dependencies get bundled into the C +directory within a distribution and are used by F or F. + +Arguments to C are module names that are checked against both +the current C<@INC> array and against specially-named directories in +C. If the bundled version is newer than the installed one (or the +module isn't installed, then, the bundled directory is added to the start +of C<@INC> and the module is loaded from there. + +There are actually two variations of C -- one for authors and +one for the C directory. For distribution authors, the C +installed in the system will record modules loaded via C and +can be used to create the bundled files in C, including writing the +second variation as C. + +This second C is the one that is loaded in a distribution +being installed (e.g. from F or F). This bundled +C is the one that determines which module to load. + +=head2 Special notes on bundling + +The C module creates bundled directories based on the packlist +file of an installed distribution. Even though C takes module +name arguments, it is better to think of it as bundling and making +available entire I. When a module is loaded through +C, it looks in all bundled distributions in C for a +newer module than can be found in the existing C<@INC> array. + +Thus, the module-name provided should usually be the "top-level" module +name of a distribution, though this is not strictly required. +C has a number of heuristics to discover module names, +allowing users to do things like this: + + use inc::latest 'Devel::AssertOS::Unix'; + +even though Devel::AssertOS::Unix is contained within the Devel-CheckOS +distribution. + +At the current time, packlists are required. Thus, bundling dual-core +modules may require a 'forced install' over versions in the latest version +of perl in order to create the necessary packlist for bundling. + +=head2 Managing dependency chains + +Before bundling a distribution you must ensure that all prerequisites are +also bundled and load in the correct order. + +For example, if you need C, but C depends on C, +and you have bundled C, your F might look like this: + + use inc::latest 'Wobble'; + use inc::latest 'Wibble'; + use inc::latest 'Module::Build'; + + Module::Build->new( + module_name => 'Foo::Bar', + license => 'perl', + )->create_build_script; + +Authors are strongly suggested to limit the bundling of additional +dependencies if at all possible and to carefully test their distribution +tarballs before uploading to CPAN. + +=head1 USAGE + +=head2 As bundled in inc/ + +Using L, a special stub module will be created in your +distribute directory as F. In your F or +F, you can then load C to load bundled modules. + +When calling C, the bundled C takes a single module name +and optional arguments to pass to that module's own import method. + + use inc::latest 'Foo::Bar' qw/foo bar baz/; + +The implementation is private. Only the C method is public. + +=head2 Author-mode + +When you have L installed from CPAN, then you are in author-mode +if any of the Author-mode methods are available. For example: + + if ( inc::latest->can('write') ) { + inc::latest->write('inc'); + } + +Using author-mode, you can create the stub F and bundle +modules into F. + +=over 4 + +=item loaded_modules() + + my @list = inc::latest->loaded_modules; + +This takes no arguments and always returns a list of module names requested +for loading via "use inc::latest 'MODULE'", regardless of whether the load +was successful or not. + +=item write() + + inc::latest->write( 'inc' ); + +This writes the bundled version of inc::latest to the directory name given +as an argument. It almost all cases, it should be 'C'. + +=item bundle_module() + + for my $mod ( inc::latest->loaded_modules ) { + inc::latest->bundle_module($mod, $dir); + } + +If $mod corresponds to a packlist, then this function creates a +specially-named directory in $dir and copies all .pm files from the modlist +to the new directory (which almost always should just be 'inc'). For +example, if Foo::Bar is the name of the module, and $dir is 'inc', then the +directory would be 'inc/inc_Foo-Bar' and contain files like this: + + inc/inc_Foo-Bar/Foo/Bar.pm + +Currently, $mod B have a packlist. If this is not the case (e.g. for +a dual-core module), then the bundling will fail. You may be able to +create a packlist by forced installing the module on top of the version +that came with core Perl. + +=back + +=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/inc-latest.git + +=head1 AUTHORS + +=over 4 + +=item * + +David Golden + +=item * + +Eric Wilhelm + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is Copyright (c) 2009 by David Golden. + +This is free software, licensed under: + + The Apache License, Version 2.0, January 2004 + +=cut diff --git a/lib/inc/latest/private.pm b/lib/inc/latest/private.pm new file mode 100644 index 0000000..65a366b --- /dev/null +++ b/lib/inc/latest/private.pm @@ -0,0 +1,147 @@ +use strict; +use warnings; + +package inc::latest::private; +# ABSTRACT: private implementation for inc::latest + +our $VERSION = '0.500'; + +use File::Spec; +use IO::File; + +# must ultimately "goto" the import routine of the module to be loaded +# so that the calling package is correct when $mod->import() runs. +sub import { + my ( $package, $mod, @args ) = @_; + my $file = $package->_mod2path($mod); + + if ( $INC{$file} ) { + # Already loaded, but let _load_module handle import args + goto \&_load_module; + } + + # A bundled copy must be present + my ( $bundled, $bundled_dir ) = $package->_search_bundled($file) + or die "No bundled copy of $mod found"; + + my $from_inc = $package->_search_INC($file); + unless ($from_inc) { + # Only bundled is available + unshift( @INC, $bundled_dir ); + goto \&_load_module; + } + + if ( _version($from_inc) >= _version($bundled) ) { + # Ignore the bundled copy + goto \&_load_module; + } + + # Load the bundled copy + unshift( @INC, $bundled_dir ); + goto \&_load_module; +} + +sub _version { + require ExtUtils::MakeMaker; + return ExtUtils::MM->parse_version(shift); +} + +# use "goto" for import to preserve caller +sub _load_module { + my $package = shift; # remaining @_ is ready for goto + my ( $mod, @args ) = @_; + eval "require $mod; 1" or die $@; + if ( my $import = $mod->can('import') ) { + goto $import; + } + return 1; +} + +sub _search_bundled { + my ( $self, $file ) = @_; + + my $mypath = 'inc'; + + local *DH; # Maintain 5.005 compatibility + opendir DH, $mypath or die "Can't open directory $mypath: $!"; + + while ( defined( my $e = readdir DH ) ) { + next unless $e =~ /^inc_/; + my $try = File::Spec->catfile( $mypath, $e, $file ); + + return ( $try, File::Spec->catdir( $mypath, $e ) ) if -e $try; + } + return; +} + +# Look for the given path in @INC. +sub _search_INC { + # TODO: doesn't handle coderefs or arrayrefs or objects in @INC, but + # it probably should + my ( $self, $file ) = @_; + + foreach my $dir (@INC) { + next if ref $dir; + my $try = File::Spec->catfile( $dir, $file ); + return $try if -e $try; + } + + return; +} + +# Translate a module name into a directory/file.pm to search for in @INC +sub _mod2path { + my ( $self, $mod ) = @_; + my @parts = split /::/, $mod; + $parts[-1] .= '.pm'; + return $parts[0] if @parts == 1; + return File::Spec->catfile(@parts); +} + +1; + + +# vim: ts=4 sts=4 sw=4 tw=75 et: + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +inc::latest::private - private implementation for inc::latest + +=head1 VERSION + +version 0.500 + +=head1 DESCRIPTION + +This module has the private methods used to find and load bundled modules. +It should not be used directly. + +=head1 AUTHORS + +=over 4 + +=item * + +David Golden + +=item * + +Eric Wilhelm + +=back + +=head1 COPYRIGHT AND LICENSE + +This software is Copyright (c) 2009 by David Golden. + +This is free software, licensed under: + + The Apache License, Version 2.0, January 2004 + +=cut diff --git a/perlcritic.rc b/perlcritic.rc new file mode 100644 index 0000000..bcbbb45 --- /dev/null +++ b/perlcritic.rc @@ -0,0 +1,26 @@ +severity = 5 +verbose = 8 + +[Variables::ProhibitPunctuationVars] +allow = $@ $! + +[TestingAndDebugging::ProhibitNoStrict] +allow = refs + +[Variables::ProhibitEvilVariables] +variables = $DB::single + +# Turn these off +[-BuiltinFunctions::ProhibitStringyEval] +[-ControlStructures::ProhibitPostfixControls] +[-ControlStructures::ProhibitUnlessBlocks] +[-Documentation::RequirePodSections] +[-InputOutput::ProhibitInteractiveTest] +[-References::ProhibitDoubleSigils] +[-RegularExpressions::RequireExtendedFormatting] +[-InputOutput::ProhibitTwoArgOpen] +[-Modules::ProhibitEvilModules] + +# Turn this on +[Lax::ProhibitStringyEval::ExceptForRequire] + diff --git a/t/00-report-prereqs.dd b/t/00-report-prereqs.dd new file mode 100644 index 0000000..cbfc97b --- /dev/null +++ b/t/00-report-prereqs.dd @@ -0,0 +1,54 @@ +do { my $x = { + 'configure' => { + 'requires' => { + 'ExtUtils::MakeMaker' => '6.17', + 'perl' => '5.006' + } + }, + 'develop' => { + 'requires' => { + 'Dist::Zilla' => '5', + 'Dist::Zilla::Plugin::SurgicalPodWeaver' => '0.0021', + 'Dist::Zilla::PluginBundle::DAGOLDEN' => '0.072', + 'File::Spec' => '0', + 'File::Temp' => '0', + 'IO::Handle' => '0', + 'IPC::Open3' => '0', + 'Pod::Coverage::TrustPod' => '0', + 'Test::CPAN::Meta' => '0', + 'Test::More' => '0', + 'Test::Pod' => '1.41', + 'Test::Pod::Coverage' => '1.08', + 'Test::Spelling' => '0.12', + 'Test::Version' => '1' + } + }, + 'runtime' => { + 'requires' => { + 'Carp' => '0', + 'ExtUtils::Installed' => '0', + 'ExtUtils::MakeMaker' => '0', + 'File::Basename' => '0', + 'File::Copy' => '0', + 'File::Path' => '0', + 'File::Spec' => '0', + 'IO::File' => '0', + 'perl' => '5.006', + 'strict' => '0', + 'warnings' => '0' + } + }, + 'test' => { + 'recommends' => { + 'CPAN::Meta' => '2.120900' + }, + 'requires' => { + 'ExtUtils::MakeMaker' => '0', + 'File::Spec' => '0', + 'Test::More' => '0', + 'perl' => '5.006' + } + } + }; + $x; + } \ No newline at end of file diff --git a/t/00-report-prereqs.t b/t/00-report-prereqs.t new file mode 100644 index 0000000..402b3d9 --- /dev/null +++ b/t/00-report-prereqs.t @@ -0,0 +1,176 @@ +#!perl + +use strict; +use warnings; + +# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.019 + +use Test::More tests => 1; + +use ExtUtils::MakeMaker; +use File::Spec; + +# from $version::LAX +my $lax_version_re = + qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? + | + (?:\.[0-9]+) (?:_[0-9]+)? + ) | (?: + v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? + | + (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? + ) + )/x; + +# hide optional CPAN::Meta modules from prereq scanner +# and check if they are available +my $cpan_meta = "CPAN::Meta"; +my $cpan_meta_pre = "CPAN::Meta::Prereqs"; +my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic + +# Verify requirements? +my $DO_VERIFY_PREREQS = 1; + +sub _max { + my $max = shift; + $max = ( $_ > $max ) ? $_ : $max for @_; + return $max; +} + +sub _merge_prereqs { + my ($collector, $prereqs) = @_; + + # CPAN::Meta::Prereqs object + if (ref $collector eq $cpan_meta_pre) { + return $collector->with_merged_prereqs( + CPAN::Meta::Prereqs->new( $prereqs ) + ); + } + + # Raw hashrefs + for my $phase ( keys %$prereqs ) { + for my $type ( keys %{ $prereqs->{$phase} } ) { + for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { + $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; + } + } + } + + return $collector; +} + +my @include = qw( + +); + +my @exclude = qw( + +); + +# Add static prereqs to the included modules list +my $static_prereqs = do 't/00-report-prereqs.dd'; + +# Merge all prereqs (either with ::Prereqs or a hashref) +my $full_prereqs = _merge_prereqs( + ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), + $static_prereqs +); + +# Add dynamic prereqs to the included modules list (if we can) +my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; +if ( $source && $HAS_CPAN_META ) { + if ( my $meta = eval { CPAN::Meta->load_file($source) } ) { + $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); + } +} +else { + $source = 'static metadata'; +} + +my @full_reports; +my @dep_errors; +my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; + +# Add static includes into a fake section +for my $mod (@include) { + $req_hash->{other}{modules}{$mod} = 0; +} + +for my $phase ( qw(configure build test runtime develop other) ) { + next unless $req_hash->{$phase}; + next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); + + for my $type ( qw(requires recommends suggests conflicts modules) ) { + next unless $req_hash->{$phase}{$type}; + + my $title = ucfirst($phase).' '.ucfirst($type); + my @reports = [qw/Module Want Have/]; + + for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { + next if $mod eq 'perl'; + next if grep { $_ eq $mod } @exclude; + + my $file = $mod; + $file =~ s{::}{/}g; + $file .= ".pm"; + my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; + + my $want = $req_hash->{$phase}{$type}{$mod}; + $want = "undef" unless defined $want; + $want = "any" if !$want && $want == 0; + + my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; + + if ($prefix) { + my $have = MM->parse_version( File::Spec->catfile($prefix, $file) ); + $have = "undef" unless defined $have; + push @reports, [$mod, $want, $have]; + + if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { + if ( $have !~ /\A$lax_version_re\z/ ) { + push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; + } + elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { + push @dep_errors, "$mod version '$have' is not in required range '$want'"; + } + } + } + else { + push @reports, [$mod, $want, "missing"]; + + if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { + push @dep_errors, "$mod is not installed ($req_string)"; + } + } + } + + if ( @reports ) { + push @full_reports, "=== $title ===\n\n"; + + my $ml = _max( map { length $_->[0] } @reports ); + my $wl = _max( map { length $_->[1] } @reports ); + my $hl = _max( map { length $_->[2] } @reports ); + splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; + + push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; + push @full_reports, "\n"; + } + } +} + +if ( @full_reports ) { + diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; +} + +if ( @dep_errors ) { + diag join("\n", + "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n", + "The following REQUIRED prerequisites were not satisfied:\n", + @dep_errors, + "\n" + ); +} + +pass; + +# vim: ts=4 sts=4 sw=4 et: diff --git a/tidyall.ini b/tidyall.ini new file mode 100644 index 0000000..91aa246 --- /dev/null +++ b/tidyall.ini @@ -0,0 +1,5 @@ +; Install Code::TidyAll +; run "tidyall -a" to tidy all files +; run "tidyall -g" to tidy only files modified from git +[PerlTidy] +select = {lib,t}/**/*.{pl,pm,t} diff --git a/xt/author/00-compile.t b/xt/author/00-compile.t new file mode 100644 index 0000000..a2e9441 --- /dev/null +++ b/xt/author/00-compile.t @@ -0,0 +1,55 @@ +use 5.006; +use strict; +use warnings; + +# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.051 + +use Test::More; + +plan tests => 2 + ($ENV{AUTHOR_TESTING} ? 1 : 0); + +my @module_files = ( + 'inc/latest.pm', + 'inc/latest/private.pm' +); + + + +# fake home for cpan-testers +use File::Temp; +local $ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 ); + + +my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; + +use File::Spec; +use IPC::Open3; +use IO::Handle; + +open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; + +my @warnings; +for my $lib (@module_files) +{ + # see L + my $stderr = IO::Handle->new; + + my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); + binmode $stderr, ':crlf' if $^O eq 'MSWin32'; + my @_warnings = <$stderr>; + waitpid($pid, 0); + is($?, 0, "$lib loaded ok"); + + if (@_warnings) + { + warn @_warnings; + push @warnings, @_warnings; + } +} + + + +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}; + + diff --git a/xt/author/critic.t b/xt/author/critic.t new file mode 100644 index 0000000..d5b4c96 --- /dev/null +++ b/xt/author/critic.t @@ -0,0 +1,12 @@ +#!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(); diff --git a/xt/author/pod-spell.t b/xt/author/pod-spell.t new file mode 100644 index 0000000..86b606e --- /dev/null +++ b/xt/author/pod-spell.t @@ -0,0 +1,27 @@ +use strict; +use warnings; +use Test::More; + +# generated by Dist::Zilla::Plugin::Test::PodSpelling 2.006008 +use Test::Spelling 0.12; +use Pod::Wordlist; + + +add_stopwords(); +all_pod_files_spelling_ok( qw( bin lib ) ); +__DATA__ +CheckOS +Devel +modlist +packlist +packlists +David +Golden +dagolden +Eric +Wilhelm +ewilhelm +lib +inc +latest +private diff --git a/xt/release/distmeta.t b/xt/release/distmeta.t new file mode 100644 index 0000000..c2280dc --- /dev/null +++ b/xt/release/distmeta.t @@ -0,0 +1,6 @@ +#!perl +# This file was automatically generated by Dist::Zilla::Plugin::MetaTests. + +use Test::CPAN::Meta; + +meta_yaml_ok(); diff --git a/xt/release/minimum-version.t b/xt/release/minimum-version.t new file mode 100644 index 0000000..708ba15 --- /dev/null +++ b/xt/release/minimum-version.t @@ -0,0 +1,8 @@ +#!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} ); diff --git a/xt/release/pod-coverage.t b/xt/release/pod-coverage.t new file mode 100644 index 0000000..66b3b64 --- /dev/null +++ b/xt/release/pod-coverage.t @@ -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 --git a/xt/release/pod-syntax.t b/xt/release/pod-syntax.t new file mode 100644 index 0000000..f0468f1 --- /dev/null +++ b/xt/release/pod-syntax.t @@ -0,0 +1,6 @@ +#!perl +# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. +use Test::More; +use Test::Pod 1.41; + +all_pod_files_ok(); diff --git a/xt/release/portability.t b/xt/release/portability.t new file mode 100644 index 0000000..58dbc20 --- /dev/null +++ b/xt/release/portability.t @@ -0,0 +1,12 @@ +#!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(); diff --git a/xt/release/test-version.t b/xt/release/test-version.t new file mode 100644 index 0000000..9bccdf0 --- /dev/null +++ b/xt/release/test-version.t @@ -0,0 +1,22 @@ +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;