Test-DiagINC-0.008/000755 000765 000024 00000000000 13136124362 014067 5ustar00davidstaff000000 000000 Test-DiagINC-0.008/Changes000644 000765 000024 00000002524 13136124362 015365 0ustar00davidstaff000000 000000 Revision history for Test-DiagINC 0.008 2017-07-26 10:36:28-04:00 America/New_York - No changes from 0.007. 0.007 2017-04-15 22:46:51-04:00 America/New_York (TRIAL RELEASE) [FIXED] - Fixed tests for perls without '.' in @INC 0.006 2016-09-23 20:39:00-04:00 America/New_York - No changes from 0.005. 0.005 2016-09-10 14:07:35-04:00 America/New_York (TRIAL RELEASE) [TESTS] - Skips taint tests on MSWin32 to avoid File::Temp bugs 0.004 2014-02-10 13:02:39-05:00 America/New_York [FIXED] - Localizes more %ENV vars to work under taint mode 0.003 2014-02-07 12:54:54-05:00 America/New_York [CHANGED] - More robust error condition detection - now triggers on failures in END-block-based test modules (e.g. Test::NoWarnings) - Add diagnostic of "Attempted-but-failed-to-load" on perl >= 5.10 - Minimize amount of reported modules: anything Test::DiagINC loads in order to compile the report is excluded - No longr chdir() during the local-library heuristic - No non-core runtime dependencies, add 5.6 support 0.002 2014-02-04 22:17:58-05:00 America/New_York [CHANGED] - Will not report modules loaded from below the current directory (suggested by Peter Rabbitson) 0.001 2014-02-04 15:12:52-05:00 America/New_York - First release Test-DiagINC-0.008/CONTRIBUTING.mkdn000644 000765 000024 00000006604 13136124362 016657 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 that 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. ### Where to send patches and pull requests If you found this distribution on Github, sending a pull-request is the best way to contribute. If a pull-request isn't possible, a bug ticket with a patch file is the next best option. As a last resort, an email to the author(s) is acceptable. ## Installing and using Dist::Zilla Dist::Zilla is not required for contributing, but if you'd like to learn more, this section will get you up to speed. 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/ Test-DiagINC-0.008/cpanfile000644 000765 000024 00000002501 13136124362 015571 0ustar00davidstaff000000 000000 requires "B" => "0"; requires "Cwd" => "0"; requires "File::Spec" => "0"; requires "perl" => "5.006"; requires "strict" => "0"; requires "warnings" => "0"; on 'test' => sub { requires "Capture::Tiny" => "0.21"; 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::ReleaseStatus::FromVersion" => "0"; 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 "Pod::Wordlist" => "0"; requires "Software::License::Apache_2_0" => "0"; requires "Test::CPAN::Meta" => "0"; requires "Test::MinimumVersion" => "0"; requires "Test::More" => "0"; requires "Test::Perl::Critic" => "0"; requires "Test::Pod" => "1.41"; requires "Test::Pod::Coverage" => "1.08"; requires "Test::Portability::Files" => "0"; requires "Test::Spelling" => "0.12"; requires "Test::Version" => "1"; requires "blib" => "1.01"; }; Test-DiagINC-0.008/dist.ini000644 000765 000024 00000000347 13136124362 015537 0ustar00davidstaff000000 000000 name = Test-DiagINC author = David Golden license = Apache_2_0 copyright_holder = David Golden copyright_year = 2014 [@DAGOLDEN] :version = 0.072 [ReleaseStatus::FromVersion] testing = third_decimal_odd Test-DiagINC-0.008/examples/000755 000765 000024 00000000000 13136124362 015705 5ustar00davidstaff000000 000000 Test-DiagINC-0.008/lib/000755 000765 000024 00000000000 13136124362 014635 5ustar00davidstaff000000 000000 Test-DiagINC-0.008/LICENSE000644 000765 000024 00000026354 13136124362 015106 0ustar00davidstaff000000 000000 This software is Copyright (c) 2014 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. Test-DiagINC-0.008/Makefile.PL000644 000765 000024 00000002471 13136124362 016045 0ustar00davidstaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.010. use strict; use warnings; use 5.006; use ExtUtils::MakeMaker 6.17; my %WriteMakefileArgs = ( "ABSTRACT" => "List modules and versions loaded if tests fail", "AUTHOR" => "David Golden ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.17" }, "DISTNAME" => "Test-DiagINC", "LICENSE" => "apache", "MIN_PERL_VERSION" => "5.006", "NAME" => "Test::DiagINC", "PREREQ_PM" => { "B" => 0, "Cwd" => 0, "File::Spec" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "Capture::Tiny" => "0.21", "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "Test::More" => 0 }, "VERSION" => "0.008", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "B" => 0, "Capture::Tiny" => "0.21", "Cwd" => 0, "ExtUtils::MakeMaker" => 0, "File::Spec" => 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); Test-DiagINC-0.008/MANIFEST000644 000765 000024 00000001205 13136124362 015216 0ustar00davidstaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.010. CONTRIBUTING.mkdn Changes LICENSE MANIFEST META.json META.yml Makefile.PL README cpanfile dist.ini examples/dies.t examples/fails.t examples/fails_in_end.t examples/lib/Foo.pm examples/lib/SyntaxErr.pm lib/Test/DiagINC.pm perlcritic.rc t/00-report-prereqs.dd t/00-report-prereqs.t t/basic.t t/leanload.t t/lib/B_laced_INC_dump.pl t/taint.t tidyall.ini xt/author/00-compile.t xt/author/critic.t xt/author/pod-coverage.t xt/author/pod-spell.t xt/author/pod-syntax.t xt/author/portability.t xt/author/test-version.t xt/release/distmeta.t xt/release/minimum-version.t Test-DiagINC-0.008/META.json000644 000765 000024 00000005560 13136124362 015516 0ustar00davidstaff000000 000000 { "abstract" : "List modules and versions loaded if tests fail", "author" : [ "David Golden " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.010, CPAN::Meta::Converter version 2.150010", "license" : [ "apache_2_0" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Test-DiagINC", "no_index" : { "directory" : [ "corpus", "examples", "t", "xt" ], "package" : [ "DB" ] }, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.17", "perl" : "5.006" } }, "develop" : { "requires" : { "Dist::Zilla" : "5", "Dist::Zilla::Plugin::ReleaseStatus::FromVersion" : "0", "Dist::Zilla::PluginBundle::DAGOLDEN" : "0.072", "File::Spec" : "0", "File::Temp" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Pod::Coverage::TrustPod" : "0", "Pod::Wordlist" : "0", "Software::License::Apache_2_0" : "0", "Test::CPAN::Meta" : "0", "Test::MinimumVersion" : "0", "Test::More" : "0", "Test::Perl::Critic" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08", "Test::Portability::Files" : "0", "Test::Spelling" : "0.12", "Test::Version" : "1", "blib" : "1.01" } }, "runtime" : { "requires" : { "B" : "0", "Cwd" : "0", "File::Spec" : "0", "perl" : "5.006", "strict" : "0", "warnings" : "0" } }, "test" : { "recommends" : { "CPAN::Meta" : "2.120900" }, "requires" : { "Capture::Tiny" : "0.21", "ExtUtils::MakeMaker" : "0", "File::Spec" : "0", "Test::More" : "0", "perl" : "5.006" } } }, "provides" : { "Test::DiagINC" : { "file" : "lib/Test/DiagINC.pm", "version" : "0.008" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/dagolden/Test-DiagINC/issues" }, "homepage" : "https://github.com/dagolden/Test-DiagINC", "repository" : { "type" : "git", "url" : "https://github.com/dagolden/Test-DiagINC.git", "web" : "https://github.com/dagolden/Test-DiagINC" } }, "version" : "0.008", "x_authority" : "cpan:DAGOLDEN", "x_contributors" : [ "Peter Rabbitson ", "Roy Ivy III " ], "x_serialization_backend" : "Cpanel::JSON::XS version 3.0225" } Test-DiagINC-0.008/META.yml000644 000765 000024 00000002207 13136124362 015341 0ustar00davidstaff000000 000000 --- abstract: 'List modules and versions loaded if tests fail' author: - 'David Golden ' build_requires: Capture::Tiny: '0.21' 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 6.010, CPAN::Meta::Converter version 2.150010' license: apache meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Test-DiagINC no_index: directory: - corpus - examples - t - xt package: - DB provides: Test::DiagINC: file: lib/Test/DiagINC.pm version: '0.008' requires: B: '0' Cwd: '0' File::Spec: '0' perl: '5.006' strict: '0' warnings: '0' resources: bugtracker: https://github.com/dagolden/Test-DiagINC/issues homepage: https://github.com/dagolden/Test-DiagINC repository: https://github.com/dagolden/Test-DiagINC.git version: '0.008' x_authority: cpan:DAGOLDEN x_contributors: - 'Peter Rabbitson ' - 'Roy Ivy III ' x_serialization_backend: 'YAML::Tiny version 1.69' Test-DiagINC-0.008/perlcritic.rc000644 000765 000024 00000001257 13136124362 016562 0ustar00davidstaff000000 000000 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] # Turn this off [-TestingAndDebugging::RequireUseStrict] Test-DiagINC-0.008/README000644 000765 000024 00000007765 13136124362 014766 0ustar00davidstaff000000 000000 NAME Test::DiagINC - List modules and versions loaded if tests fail VERSION version 0.008 SYNOPSIS # preferably load before anything else use if $ENV{AUTOMATED_TESTING}, 'Test::DiagINC'; use Test::More; DESCRIPTION Assuming you shipped your module to CPAN with working tests, test failures from CPAN Testers might be due to platform issues, Perl version issues or problems with dependencies. This module helps you diagnose deep dependency problems by showing you exactly what modules and versions were loaded during a test run. When this module is loaded, it sets up an "END" block that will take action if the program is about to exit with a non-zero exit code or if $test_builder->is_passing is false by the time the "END" block is reached. If that happens, this module prints out the names and version numbers of non-local modules appearing in %INC at the end of the test. For example: $ perl -MTest::DiagINC -MTest::More -e 'fail("meh"); done_testing' not ok 1 - meh # Failed test 'meh' # at -e line 1. 1..1 # Looks like you failed 1 test of 1. # Listing modules and versions from %INC # 5.018002 Config # 5.68 Exporter # 5.68 Exporter::Heavy # 1.07 PerlIO # 0.98 Test::Builder # 0.98 Test::Builder::Module # 0.003 Test::DiagINC # 0.98 Test::More # 1.22 overload # 0.02 overloading # 1.07 strict # 1.03 vars # 1.18 warnings # 1.02 warnings::register This module deliberately does not load any other modules during runtime, instead delaying all loads until it needs to generate a failure report in its "END" block. The only exception is loading strict and warnings for self-check if and only if "RELEASE_TESTING" is true. Therefore an empty invocation will look like this: $ perl -MTest::DiagINC -e 'exit(1)' # Listing modules from %INC # 0.003 Test::DiagINC NOTE: Because this module uses an "END" block, it is a good idea to load it as early as possible, so the "END" block it installs will execute as late as possible (see perlmod for details on how this works). While this module does employ some cleverness to work around load order, it is still a heuristic and is no substitute to loading this module early. A notable side-effect is when a module is loaded in an "END" block executing after the one installed by this library: such modules will be "invisible" to us and will not be reported as part of the diagnostic report. Modules that appear to be sourced from below the current directory when "Test::DiagINC" was loaded will be excluded from the report (e.g. excludes local modules from "./", "lib/", "t/lib", and so on). The heuristic of searching %INC for loaded modules may fail if the module path loaded does not map to a package within the module file. If "Test::More" is loaded, the output will go via the "diag" function. Otherwise, it will just be sent to STDERR. 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/Test-DiagINC.git AUTHOR David Golden CONTRIBUTORS * Peter Rabbitson * Roy Ivy III COPYRIGHT AND LICENSE This software is Copyright (c) 2014 by David Golden. This is free software, licensed under: The Apache License, Version 2.0, January 2004 Test-DiagINC-0.008/t/000755 000765 000024 00000000000 13136124362 014332 5ustar00davidstaff000000 000000 Test-DiagINC-0.008/tidyall.ini000644 000765 000024 00000000240 13136124362 016226 0ustar00davidstaff000000 000000 ; 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} Test-DiagINC-0.008/xt/000755 000765 000024 00000000000 13136124362 014522 5ustar00davidstaff000000 000000 Test-DiagINC-0.008/xt/author/000755 000765 000024 00000000000 13136124362 016024 5ustar00davidstaff000000 000000 Test-DiagINC-0.008/xt/release/000755 000765 000024 00000000000 13136124362 016142 5ustar00davidstaff000000 000000 Test-DiagINC-0.008/xt/release/distmeta.t000644 000765 000024 00000000172 13136124362 020141 0ustar00davidstaff000000 000000 #!perl # This file was automatically generated by Dist::Zilla::Plugin::MetaTests. use Test::CPAN::Meta; meta_yaml_ok(); Test-DiagINC-0.008/xt/release/minimum-version.t000644 000765 000024 00000000266 13136124362 021471 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} ); Test-DiagINC-0.008/xt/author/00-compile.t000644 000765 000024 00000002660 13136124362 020062 0ustar00davidstaff000000 000000 use 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.056 use Test::More; plan tests => 2; my @module_files = ( 'Test/DiagINC.pm' ); # fake home for cpan-testers use File::Temp; local $ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 ); my @switches = ( -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; diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} } $^X, @switches, '-e', "require q[$lib]")) if $ENV{PERL_COMPILE_TEST_DEBUG}; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ and not eval { require blib; blib->VERSION('1.01') }; if (@_warnings) { warn @_warnings; 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) ); Test-DiagINC-0.008/xt/author/critic.t000644 000765 000024 00000000201 13136124362 017457 0ustar00davidstaff000000 000000 #!perl use strict; use warnings; use Test::Perl::Critic (-profile => "perlcritic.rc") x!! -e "perlcritic.rc"; all_critic_ok(); Test-DiagINC-0.008/xt/author/pod-coverage.t000644 000765 000024 00000000334 13136124362 020564 0ustar00davidstaff000000 000000 #!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' }); Test-DiagINC-0.008/xt/author/pod-spell.t000644 000765 000024 00000000466 13136124362 020116 0ustar00davidstaff000000 000000 use strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::PodSpelling 2.007004 use Test::Spelling 0.12; use Pod::Wordlist; add_stopwords(); all_pod_files_spelling_ok( qw( bin lib ) ); __DATA__ David DiagINC Golden III Ivy Peter Rabbitson Roy Test dagolden lib ribasushi rivy Test-DiagINC-0.008/xt/author/pod-syntax.t000644 000765 000024 00000000252 13136124362 020316 0ustar00davidstaff000000 000000 #!perl # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); Test-DiagINC-0.008/xt/author/portability.t000644 000765 000024 00000000322 13136124362 020550 0ustar00davidstaff000000 000000 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(); Test-DiagINC-0.008/xt/author/test-version.t000644 000765 000024 00000000637 13136124362 020661 0ustar00davidstaff000000 000000 use strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::Version 1.09 use Test::Version; my @imports = qw( version_all_ok ); my $params = { is_strict => 0, has_version => 1, multiple => 0, }; push @imports, $params if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); Test::Version->import(@imports); version_all_ok; done_testing; Test-DiagINC-0.008/t/00-report-prereqs.dd000644 000765 000024 00000005265 13136124362 020062 0ustar00davidstaff000000 000000 do { my $x = { 'configure' => { 'requires' => { 'ExtUtils::MakeMaker' => '6.17', 'perl' => '5.006' } }, 'develop' => { 'requires' => { 'Dist::Zilla' => '5', 'Dist::Zilla::Plugin::ReleaseStatus::FromVersion' => '0', 'Dist::Zilla::PluginBundle::DAGOLDEN' => '0.072', 'File::Spec' => '0', 'File::Temp' => '0', 'IO::Handle' => '0', 'IPC::Open3' => '0', 'Pod::Coverage::TrustPod' => '0', 'Pod::Wordlist' => '0', 'Software::License::Apache_2_0' => '0', 'Test::CPAN::Meta' => '0', 'Test::MinimumVersion' => '0', 'Test::More' => '0', 'Test::Perl::Critic' => '0', 'Test::Pod' => '1.41', 'Test::Pod::Coverage' => '1.08', 'Test::Portability::Files' => '0', 'Test::Spelling' => '0.12', 'Test::Version' => '1', 'blib' => '1.01' } }, 'runtime' => { 'requires' => { 'B' => '0', 'Cwd' => '0', 'File::Spec' => '0', 'perl' => '5.006', 'strict' => '0', 'warnings' => '0' } }, 'test' => { 'recommends' => { 'CPAN::Meta' => '2.120900' }, 'requires' => { 'Capture::Tiny' => '0.21', 'ExtUtils::MakeMaker' => '0', 'File::Spec' => '0', 'Test::More' => '0', 'perl' => '5.006' } } }; $x; }Test-DiagINC-0.008/t/00-report-prereqs.t000644 000765 000024 00000013426 13136124362 017734 0ustar00davidstaff000000 000000 #!perl use strict; use warnings; # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.027 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'; my $cpan_meta_error; if ( $source && $HAS_CPAN_META && (my $meta = eval { CPAN::Meta->load_file($source) } ) ) { $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); } else { $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) $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 ); if ($type eq 'modules') { splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; } else { 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 ( $cpan_meta_error || @dep_errors ) { diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; } if ( $cpan_meta_error ) { my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; } if ( @dep_errors ) { diag join("\n", "\nThe following REQUIRED prerequisites were not satisfied:\n", @dep_errors, "\n" ); } pass; # vim: ts=4 sts=4 sw=4 et: Test-DiagINC-0.008/t/basic.t000644 000765 000024 00000003515 13136124362 015604 0ustar00davidstaff000000 000000 use strict; use warnings; use Test::More; use Capture::Tiny 0.21 qw/capture/; use File::Spec; use Config; my @testfiles = qw/fails.t dies.t/; push @testfiles, 'fails_in_end.t' unless $] < 5.008; plan tests => @testfiles * ( $] < 5.010 ? 3 : 4 ); my $tainted_run = !eval { $ENV{PATH} . kill(0) and 1 } and diag( __FILE__ . ' running under taint mode' ); local $ENV{AUTOMATED_TESTING} = 1; # untaint PATH but do not unset it so we test that $^X will # run with it just fine; Sadly, Travis CI runs with relative # paths in PATH so we have to make them absolute, which also # taints them, so we untaint only after we're all done cleaning if ($tainted_run) { delete $ENV{$_} for qw(IFS CDPATH ENV BASH_ENV); my $new_path = join( $Config{path_sep}, map { File::Spec->rel2abs($_) } grep { length($_) } split /\Q$Config{path_sep}\E/, $ENV{PATH} ); ( $ENV{PATH} ) = $new_path =~ /(.*)/; } for my $file (@testfiles) { my ( $stdout, $stderr ) = capture { system( ( $^X =~ /(.+)/ ), # $^X is internal how can it be tainted?! ( $tainted_run ? (qw( -I . -I lib -T )) : () ), "examples/$file" ); }; like( $stderr, qr/\QListing modules from %INC/, "$file: Saw diagnostic header" ); like( $stderr, qr/[0-9.]+\s+ExtUtils::MakeMaker/, "$file: Saw EUMM in module list" ); unlike( $stderr, qr/Foo/, "$file: Did not see local module Foo in module list", ); like( $stderr, qr/Found and failed to load\s+[\w\:]*SyntaxErr/, "$file: Saw failed load attempt of SyntaxErr" ) unless $] < 5.010; } # # This file is part of Test-DiagINC # # This software is Copyright (c) 2014 by David Golden. # # This is free software, licensed under: # # The Apache License, Version 2.0, January 2004 # # vim: ts=4 sts=4 sw=4 et: Test-DiagINC-0.008/t/leanload.t000644 000765 000024 00000003355 13136124362 016304 0ustar00davidstaff000000 000000 # # WE ARE DOING %INC EXAMS IN THIS TEST # No Test::More loaded, all TAP output by hand # BEGIN { if ( keys %INC ) { print "1..0 # SKIP Your %INC is already populated, perhaps PERL5OPTS is set?\n"; exit 0; } } # madness explanation at the top of Test::DiagInc BEGIN { if ( $ENV{RELEASE_TESTING} ) { require warnings && warnings->import; require strict && strict->import; } @::initial_INC = keys %INC; unless ( $] < 5.008 ) { @::B_inc = split /\0/, `$^X t/lib/B_laced_INC_dump.pl`; } } my $nongreat_success; END { cmp_inc_contents( @::initial_INC, 'Test/DiagINC.pm', @::B_inc ); print "1..4\n"; $? ||= ( $nongreat_success || 0 ); } sub cmp_inc_contents { my %current_inc = %INC; my ( $seen, @leftover_keys ); for (@_) { next if $seen->{$_}++; if ( exists $current_inc{$_} ) { delete $current_inc{$_}; } else { push @leftover_keys, $_; } } my $fail = 0; if ( my @mods = sort keys %current_inc ) { $_ =~ s|/|::|g for @mods; $_ =~ s|\.pm$|| for @mods; print "not ok - the following modules were unexpectedly found in %INC: @mods\n"; $fail++; } else { print "ok - %INC does not contain anything extra\n"; } if (@leftover_keys) { $_ =~ s|/|::|g for @leftover_keys; $_ =~ s|\.pm$|| for @leftover_keys; print "not ok - the following modules were expected but not found in %INC: @leftover_keys\n"; $fail++; } else { print "ok - %INC contents as expected\n"; } $nongreat_success += $fail; } use Test::DiagINC; BEGIN { cmp_inc_contents( @::initial_INC, 'Test/DiagINC.pm' ) } Test-DiagINC-0.008/t/lib/000755 000765 000024 00000000000 13136124362 015100 5ustar00davidstaff000000 000000 Test-DiagINC-0.008/t/taint.t000644 000765 000024 00000002374 13136124362 015644 0ustar00davidstaff000000 000000 use warnings; use strict; use File::Spec; use Config; # operation of File::Temp under taint-check is broken for 'MSWin32' with non-user writable root directory (default for Win8+) # ... here File::Temp is required by Capture::Tiny in 'basic.t' # ... fix for File::Temp is committed but not distributed # ... ref: [RT#60340](https://rt.cpan.org/Ticket/Display.html?id=60340) # ToDO: revisit after File::Temp > v0.2302 is released if ('MSWin32' eq $^O) { print "1..0 # SKIP broken (by File::Temp) on many 'MSWin32' platforms...\n"; exit 0; } # there is talk of possible perl compilations where -T is a fatal # we don't want to have the user deal with that system( $^X => -T => -e => 'use warnings; use strict; exit 0' ); if ($?) { print "1..0 # SKIP Your perl does not seem to like -T...\n"; exit 0; } # Taint mode ignores PERL5LIB, we have to convert to -I switches just # like Test::Harness does my @lib_switches; for my $env ( grep { defined $ENV{$_} } (qw/PERL5LIB PERLLIB/) ) { push @lib_switches, map { "-I$_" } grep { length($_) } split /\Q$Config{path_sep}\E/, $ENV{$env}; } # all is well - just rerun the basic test exec( $^X => -T => @lib_switches => File::Spec->catpath( ( File::Spec->splitpath(__FILE__) )[ 0, 1 ], 'basic.t' ) ); Test-DiagINC-0.008/t/lib/B_laced_INC_dump.pl000644 000765 000024 00000000371 13136124362 020465 0ustar00davidstaff000000 000000 my %inc_copy = %INC; delete $inc_copy{ +__FILE__ }; if ( keys %inc_copy ) { print STDERR "%INC can not be populated when loading @{[ __FILE__ ]}\n"; exit 255; } require B; print join "\0", sort grep { $_ ne __FILE__ } keys %INC; exit 0; Test-DiagINC-0.008/lib/Test/000755 000765 000024 00000000000 13136124362 015554 5ustar00davidstaff000000 000000 Test-DiagINC-0.008/lib/Test/DiagINC.pm000644 000765 000024 00000020622 13136124362 017312 0ustar00davidstaff000000 000000 use 5.006; package Test::DiagINC; # ABSTRACT: List modules and versions loaded if tests fail our $VERSION = '0.008'; # If the tested module did not load strict/warnings we do not want # to load them either. On the other hand we would like to know our # code is at least somewhat ok. Therefore this madness ;) BEGIN { if ( $ENV{RELEASE_TESTING} ) { require warnings && warnings->import; require strict && strict->import; } } sub _max_length { my $max = 0; do { $max = length if length > $max } for @_; return $max; } # Get our CWD *without* loading anything. Original idea by xdg++ # ribasushi thinks this is fragile and will break sooner rather than # later, but adding it as is because haarg and xdg both claim it's fine. # Requires %ENV cleanup to work under taint mode my $REALPATH_CWD = do { local $ENV{PATH}; local $ENV{IFS}; local $ENV{CDPATH}; local $ENV{ENV}; local $ENV{BASH_ENV}; my ($perl) = $^X =~ /(.+)/; # $^X is internal how could it be tainted?! `"$perl" -MCwd -le "print getcwd"`; }; chomp $REALPATH_CWD; my $ORIGINAL_PID = $$; END { if ( $$ == $ORIGINAL_PID ) { # make sure we report only on stuff that was loaded by the test, # nothing more # get a snapshot early in order to not misreport B.pm and friends # below - this *will* skip any extra modules loaded in END, it was # deemed an acceptable compromise by ribasushi and xdg my @INC_list = keys %INC; # If we meet the "fail" criteria - no need to load B and fire # an extra check in an extra END (also doesn't work on 5.6) if ( _assert_no_fail(@INC_list) and $] >= 5.008 ) { # we did not report anything yet - add an extra END to catch # possible future-fails require B; push @{ B::end_av()->object_2svref }, sub { _assert_no_fail(@INC_list); }; } } } # Dump %INC IFF in the main process and test is failing or exit is non-zero # return true if no failure or if PID mismatches, return false otherwise sub _assert_no_fail { return 1 if $$ != $ORIGINAL_PID; if ( $? or ( $INC{'Test/Builder.pm'} and Test::Builder->can('is_passing') and !Test::Builder->new->is_passing ) ) { require Cwd; require File::Spec; require Cwd; my %results; for my $pkg_as_path (@_) { next unless ( my $p = $pkg_as_path ) =~ s/\.pm\z//; $p =~ s{/}{::}g; next unless $p =~ /\A[A-Z_a-z][0-9A-Z_a-z]*(?:::[0-9A-Z_a-z]+)*\Z/; # a module we recorded as INCed disappeared... if ( not exists $INC{$pkg_as_path} ) { $results{$p} = 'Module unloaded in END...?'; next; } if ( not defined $INC{$pkg_as_path} ) { $results{$p} = 'Found and failed to load'; next; } next if ( # rel2abs on an absolute path is a noop # https://metacpan.org/source/SMUELLER/PathTools-3.40/lib/File/Spec/Unix.pm#L474 # https://metacpan.org/source/SMUELLER/PathTools-3.40/lib/File/Spec/Win32.pm#L324 Cwd::realpath( File::Spec->rel2abs( $INC{$pkg_as_path}, $REALPATH_CWD ) ) =~ m| \A \Q$REALPATH_CWD\E [\\\/] |x ); my $ver = do { local $@; my $v = eval { $p->VERSION }; $@ ? '->VERSION call failed' : $v; }; $ver = 'undef' unless defined $ver; $results{$p} = $ver; } my $diag = "Listing modules from %INC\n"; my $ml = _max_length( keys %results ); my $vl = _max_length( values %results ); for ( sort keys %results ) { $diag .= sprintf( " %*s %*s\n", # pairs of [ padding-length => content ] $vl => $results{$_}, -$ml => $_ ); } if ( $INC{"Test/Builder.pm"} ) { Test::Builder->new->diag($diag); } else { $diag =~ s/^/# /mg; print STDERR $diag; } return 0; } return 1; } 1; # vim: ts=4 sts=4 sw=4 et: __END__ =pod =encoding UTF-8 =head1 NAME Test::DiagINC - List modules and versions loaded if tests fail =head1 VERSION version 0.008 =head1 SYNOPSIS # preferably load before anything else use if $ENV{AUTOMATED_TESTING}, 'Test::DiagINC'; use Test::More; =head1 DESCRIPTION Assuming you shipped your module to CPAN with working tests, test failures from L might be due to platform issues, Perl version issues or problems with dependencies. This module helps you diagnose deep dependency problems by showing you exactly what modules and versions were loaded during a test run. When this module is loaded, it sets up an C block that will take action if the program is about to exit with a non-zero exit code or if L<< $test_builder->is_passing|Test::Builder/is_passing >> is false by the time the C block is reached. If that happens, this module prints out the names and version numbers of non-local modules appearing in L<%INC|perlvar/%INC> at the end of the test. For example: $ perl -MTest::DiagINC -MTest::More -e 'fail("meh"); done_testing' not ok 1 - meh # Failed test 'meh' # at -e line 1. 1..1 # Looks like you failed 1 test of 1. # Listing modules and versions from %INC # 5.018002 Config # 5.68 Exporter # 5.68 Exporter::Heavy # 1.07 PerlIO # 0.98 Test::Builder # 0.98 Test::Builder::Module # 0.003 Test::DiagINC # 0.98 Test::More # 1.22 overload # 0.02 overloading # 1.07 strict # 1.03 vars # 1.18 warnings # 1.02 warnings::register This module deliberately does not load B during runtime, instead delaying all loads until it needs to generate a failure report in its C block. The only exception is loading L and L for self-check B C is true. Therefore an empty invocation will look like this: $ perl -MTest::DiagINC -e 'exit(1)' # Listing modules from %INC # 0.003 Test::DiagINC B: Because this module uses an C block, it is a good idea to load it as early as possible, so the C block it installs will execute as B as possible (see L for details on how this works). While this module does employ some cleverness to work around load order, it is still a heuristic and is no substitute to loading this module early. A notable side-effect is when a module is loaded in an C block executing B the one installed by this library: such modules will be "invisible" to us and will not be reported as part of the diagnostic report. Modules that appear to be sourced from below the current directory when C was loaded will be excluded from the report (e.g. excludes local modules from C<./>, C, C, and so on). The heuristic of searching C<%INC> for loaded modules may fail if the module path loaded does not map to a package within the module file. If C is loaded, the output will go via the C function. Otherwise, it will just be sent to STDERR. =for Pod::Coverage BUILD =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/Test-DiagINC.git =head1 AUTHOR David Golden =head1 CONTRIBUTORS =for stopwords Peter Rabbitson Roy Ivy III =over 4 =item * Peter Rabbitson =item * Roy Ivy III =back =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2014 by David Golden. This is free software, licensed under: The Apache License, Version 2.0, January 2004 =cut Test-DiagINC-0.008/examples/dies.t000644 000765 000024 00000000370 13136124362 017016 0ustar00davidstaff000000 000000 use strict; use warnings; use if $ENV{AUTOMATED_TESTING}, 'Test::DiagINC'; use ExtUtils::MakeMaker; use lib 'examples/lib'; use Foo; eval { require SyntaxErr }; chdir ".." or die "$!"; # try to mess up relative entry in %INC die("this fails\n"); Test-DiagINC-0.008/examples/fails.t000644 000765 000024 00000000325 13136124362 017170 0ustar00davidstaff000000 000000 use strict; use warnings; use Test::More tests => 1; use if $ENV{AUTOMATED_TESTING}, 'Test::DiagINC'; use ExtUtils::MakeMaker (); use lib 'examples/lib'; use Foo; eval { require SyntaxErr }; fail("this failed"); Test-DiagINC-0.008/examples/fails_in_end.t000644 000765 000024 00000000430 13136124362 020501 0ustar00davidstaff000000 000000 use strict; use warnings; # simulate what a Test::NoWarnings invocation looks like use Test::More tests => 1; END { fail("this failed") } use if $ENV{AUTOMATED_TESTING}, 'Test::DiagINC'; use ExtUtils::MakeMaker (); use lib 'examples/lib'; use Foo; eval { require SyntaxErr }; Test-DiagINC-0.008/examples/lib/000755 000765 000024 00000000000 13136124362 016453 5ustar00davidstaff000000 000000 Test-DiagINC-0.008/examples/lib/Foo.pm000644 000765 000024 00000000053 13136124362 017532 0ustar00davidstaff000000 000000 use strict; use warnings; package Foo; 1; Test-DiagINC-0.008/examples/lib/SyntaxErr.pm000644 000765 000024 00000000027 13136124362 020747 0ustar00davidstaff000000 000000 asphinctersayswhat 0;