From 9dcf0b8f386a7b2dd25b2f5340ad48ad339a6f6b Mon Sep 17 00:00:00 2001 From: TizenOpenSource Date: Wed, 14 Feb 2024 16:11:30 +0900 Subject: [PATCH 2/4] Imported Upstream version 0.31 --- CONTRIBUTING | 105 +++ Changes | 129 ++++ INSTALL | 75 +++ LICENCE | 32 + MANIFEST | 40 ++ META.json | 1348 ++++++++++++++++++++++++++++++++++++++ META.yml | 920 ++++++++++++++++++++++++++ Makefile.PL | 61 ++ README | 13 + dist.ini | 47 ++ lib/Try/Tiny.pm | 820 +++++++++++++++++++++++ maint/bench.pl | 14 + t/00-report-prereqs.dd | 155 +++++ t/00-report-prereqs.t | 200 ++++++ t/basic.t | 163 +++++ t/context.t | 62 ++ t/erroneous_usage.t | 74 +++ t/finally.t | 140 ++++ t/given_when.t | 38 ++ t/global_destruction_forked.t | 58 ++ t/global_destruction_load.t | 19 + t/lib/TryUser.pm | 9 + t/named.t | 35 + t/when.t | 36 + t/zzz-check-breaks.t | 36 + xt/author/00-compile.t | 60 ++ xt/author/distmeta.t | 6 + xt/author/eol.t | 41 ++ xt/author/kwalitee.t | 9 + xt/author/minimum-version.t | 6 + xt/author/mojibake.t | 9 + xt/author/no-tabs.t | 41 ++ xt/author/pod-coverage.t | 7 + xt/author/pod-no404s.t | 21 + xt/author/pod-spell.t | 86 +++ xt/author/pod-syntax.t | 7 + xt/author/portability.t | 10 + xt/release/changes_has_content.t | 42 ++ xt/release/cpan-changes.t | 10 + 39 files changed, 4984 insertions(+) create mode 100644 CONTRIBUTING create mode 100644 Changes create mode 100644 INSTALL create mode 100644 LICENCE create mode 100644 MANIFEST create mode 100644 META.json create mode 100644 META.yml create mode 100644 Makefile.PL create mode 100644 README create mode 100644 dist.ini create mode 100644 lib/Try/Tiny.pm create mode 100644 maint/bench.pl create mode 100644 t/00-report-prereqs.dd create mode 100644 t/00-report-prereqs.t create mode 100644 t/basic.t create mode 100644 t/context.t create mode 100644 t/erroneous_usage.t create mode 100644 t/finally.t create mode 100644 t/given_when.t create mode 100644 t/global_destruction_forked.t create mode 100644 t/global_destruction_load.t create mode 100644 t/lib/TryUser.pm create mode 100644 t/named.t create mode 100644 t/when.t create mode 100644 t/zzz-check-breaks.t create mode 100644 xt/author/00-compile.t create mode 100644 xt/author/distmeta.t create mode 100644 xt/author/eol.t create mode 100644 xt/author/kwalitee.t create mode 100644 xt/author/minimum-version.t create mode 100644 xt/author/mojibake.t create mode 100644 xt/author/no-tabs.t create mode 100644 xt/author/pod-coverage.t create mode 100644 xt/author/pod-no404s.t create mode 100644 xt/author/pod-spell.t create mode 100644 xt/author/pod-syntax.t create mode 100644 xt/author/portability.t create mode 100644 xt/release/changes_has_content.t create mode 100644 xt/release/cpan-changes.t diff --git a/CONTRIBUTING b/CONTRIBUTING new file mode 100644 index 0000000..4f07af6 --- /dev/null +++ b/CONTRIBUTING @@ -0,0 +1,105 @@ + +CONTRIBUTING + +Thank you for considering contributing to this distribution. This file +contains instructions that will help you work with the source code. + +PLEASE NOTE that if you have any questions or difficulties, you can reach the +maintainer(s) through the bug queue described later in this document +(preferred), or by emailing the releaser directly. You are not required to +follow any of the steps in this document to submit a patch or bug report; +these are just recommendations, intended to help you (and help us help you +faster). + +The distribution is managed with Dist::Zilla (https://metacpan.org/release/Dist-Zilla). +This means than many of the usual files you might expect are not in the +repository, but are generated at release time (e.g. Makefile.PL). + +However, you can run tests directly using the 'prove' tool: + + $ prove -l + $ prove -lv t/some_test_file.t + $ prove -lvr t/ + +In most cases, 'prove' is entirely sufficient for you to test any patches you +have. + +You may need to satisfy some dependencies. The easiest way to satisfy +dependencies is to install the last release -- this is available at +https://metacpan.org/release/Try-Tiny + +If you use cpanminus, you can do it without downloading the tarball first: + + $ cpanm --reinstall --installdeps --with-recommends Try::Tiny + +Dist::Zilla is a very powerful authoring tool, but requires a number of +author-specific plugins. If you would like to use it for contributing, +install it from CPAN, then run one of the following commands, depending on +your CPAN client: + + $ cpan `dzil authordeps --missing` +or + $ dzil authordeps --missing | cpanm + +You should then also install any additional requirements not needed by the +dzil build but may be needed by tests or other development: + + $ cpan `dzil listdeps --author --missing` +or + $ dzil listdeps --author --missing | cpanm + +Or, you can use the 'dzil stale' command to install all requirements at once: + + $ cpan Dist::Zilla::App::Command::stale + $ cpan `dzil stale --all` +or + $ cpanm Dist::Zilla::App::Command::stale + $ dzil stale --all | cpanm + +You can also do this via cpanm directly: + + $ cpanm --reinstall --installdeps --with-develop --with-recommends Try::Tiny + +Once installed, here are some dzil commands you might try: + + $ dzil build + $ dzil test + $ dzil test --release + $ dzil xtest + $ dzil listdeps --json + $ dzil build --notgz + +You can learn more about Dist::Zilla at http://dzil.org/. + +The code for this distribution is hosted at GitHub. The repository is: + +https://github.com/p5sagit/Try-Tiny + +You can submit code changes by forking the repository, pushing your code +changes to your clone, and then submitting a pull request. Please include a +suitable end-user-oriented entry in the Changes file describing your change. +Detailed instructions for doing that is available here: + +https://help.github.com/articles/creating-a-pull-request + +All pull requests for this distribution will be automatically tested on Linux +by Travis at: https://travis-ci.com/p5sagit/Try-Tiny +Results will be visible in the pull request on GitHub. Follow the appropriate +links for details when tests fail. Changes will not be mergeable until all +tests pass. + +If you have found a bug, but do not have an accompanying patch to fix it, you +can submit an issue report here: +https://rt.cpan.org/Public/Dist/Display.html?Name=Try-Tiny +or via email: bug-Try-Tiny@rt.cpan.org +This is a good place to send your questions about the usage of this distribution. + +If you send me a patch or pull request, your name and email address will be +included in the documentation as a contributor (using the attribution on the +commit or patch), unless you specifically request for it not to be. If you +wish to be listed under a different name or address, you should submit a pull +request to the .mailmap file to contain the correct mapping. + + +This file was generated via Dist::Zilla::Plugin::GenerateFile::FromShareDir 0.015 +from a template file originating in Dist-Zilla-PluginBundle-Author-ETHER-0.161. diff --git a/Changes b/Changes new file mode 100644 index 0000000..8bc4935 --- /dev/null +++ b/Changes @@ -0,0 +1,129 @@ +Revision history for Try-Tiny + +0.31 2021-11-23 20:29:12Z + - plug Syntax::Keyword::Try and Feature::Compat::Try in the docs + +0.30 2017-12-21 07:23:03Z + - expand "when" test skippage to more perl versions + +0.29 2017-12-19 03:51:26Z + - skip tests of "when" and "given/when" usage for perl 5.27.7 *only* (see + RT#123908) + +0.28 2017-01-09 01:21:33Z + - enabled some tests of finally blocks that were disabled on 5.6, now that + that functionality works (since 0.13) (Pali, PR#4) + +0.27 2016-08-16 01:43:35Z + - repository moved to the github p5sagit organization (the primary is on + shadowcat, mirrored to github) + - no changes since 0.26 + +0.26 2016-03-15 23:42:02Z (TRIAL RELEASE) + - switch from finalizers using an array to a hash, to resolve segfaults when + creating a pseudofork on MSWin before perl 5.20 (Graham Knop, + karenetheridge/Sub-Name/#3) + +0.25 2016-02-22 20:16:51Z (TRIAL RELEASE) + - "finally" blocks are now run for all methods of leaving the try block + (including via exit, goto) (Lukas Mai, RT#112099) + +0.24 2015-12-11 05:20:09Z + - fix prereq errors in 0.23 + +0.23 2015-12-11 04:04:35Z + - fix syntax of example code (Rudolf Leermakers, doy/Sub-Name/#22) + - 'perl' removed from prerequisite recommendations, to avoid tripping up + CPAN clients (Graham Knop) + - Sub::Util is used preferentially to Sub::Name in most cases (Graham Knop, + doy/Sub-Name/#27) + +0.22 2014-04-29 + - add optional test deps as recommended prereqs (Karen Etheridge, + doy/Sub-Name/#18) + +0.21 2014-04-15 + - also skip the test if Capture::Tiny is too old (Martin Popel, + doy/Sub-Name/#17) + +0.20 2014-03-21 + - documentation updates (David Lowe (Flimm), doy/Sub-Name/#15) + +0.19 2014-01-22 + - fix an obscure issue with loading modules during global destruction + (Dagfinn Ilmari Mannsåker, doy/Sub-Name/#11) + - documentation updates (anaxagoras, doy/Sub-Name/#12) + +0.18 2013-08-17 + - fix tests for pre-Test-More-0.88 (Paul Howarth, doy/Sub-Name/#10) + +0.17 2013-08-16 + - work around [rt.perl #119311] which was causing incorrect error messages in + some cases during global destruction (Graham Knop, doy/Sub-Name/#9) + +0.16 2013-07-10 + - remove accidental Sub::Name test dep + +0.15 2013-07-08 + - optionally use Sub::Name to name the try/catch/finally blocks, if available + (Mark Fowler) + +0.14 2013-07-05 + - also throw an exception for catch/finally in scalar context (RT#81070) + +0.13 2013-07-04 + - fix tests failing on 5.6.x due to differing DESTROY semantics + - excise superfluous local($@) call - 7% speedup + - fix (fsvo) broken URLs (RT#55659) + - proper exception on erroneous usage of bare catch/finally (RT#81070) + - proper exception on erroneous use of multiple catch{} blocks + - clarify exception occuring on unterminated try block (RT#75712) + - fix the prototypes shown in docs to match code (RT#79590; thanks, Pushtaev + Vadim) + - warn loudly on exceptions in finally() blocks + - dzilify + +0.12 2013-01-02 + - doc fixes + +0.11 2011-08-30 + - fix broken dist + +0.10 2011-04-27 + - clarify some docs + +0.09 2010-11-28 + - don't index Try::Tiny::ScopeGuard + +0.08 2010-11-28 + - fix require vs use issue in blead (RT63410) + +0.07 2010-10-21 + - allow multiple finally blocks + - pass the error, if any, to finally blocks when called + +0.06 2010-05-27 + - in t/given_when.t use a plan instead of done_testing for more backwards + compatibility + +0.05 2010-05-26 + - Documentation fixes and clarifications + +0.04 2010-01-22 + - Restore list context propagation for catch blocks + - Fix a bug where finally blocks weren't always invoked + +0.03 2010-01-22 + - Support for 'finally' blocks (Andy Yates) + - More documentation and tests (many people) + - Sets $@ to the previous value at the beginning of the eval, to allow + the capture of an error stack when calling die. + +0.02 2009-09-02 + - Doc fixes from chromatic + - Various minor fixes from Adam Kennedy + - Additional documentation and code clarifications + - 5.005_04 compatibility + +0.01 2009-08-31 + - Initial release diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..93ff671 --- /dev/null +++ b/INSTALL @@ -0,0 +1,75 @@ +This is the Perl distribution Try-Tiny. + +Installing Try-Tiny is straightforward. + +## Installation with cpanm + +If you have cpanm, you only need one line: + + % cpanm Try::Tiny + +If it does not have permission to install modules to the current perl, cpanm +will automatically set up and install to a local::lib in your home directory. +See the local::lib documentation (https://metacpan.org/pod/local::lib) for +details on enabling it in your environment. + +## Installing with the CPAN shell + +Alternatively, if your CPAN shell is set up, you should just be able to do: + + % cpan Try::Tiny + +## Manual installation + +As a last resort, you can manually install it. If you have not already +downloaded the release tarball, you can find the download link on the module's +MetaCPAN page: https://metacpan.org/pod/Try::Tiny + +Untar the tarball, install configure prerequisites (see below), then build it: + + % perl Makefile.PL + % make && make test + +Then install it: + + % make install + +On Windows platforms, you should use `dmake` or `nmake`, instead of `make`. + +If your perl is system-managed, you can create a local::lib in your home +directory to install modules to. For details, see the local::lib documentation: +https://metacpan.org/pod/local::lib + +The prerequisites of this distribution will also have to be installed manually. The +prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json` generated +by running the manual build process described above. + +## Configure Prerequisites + +This distribution requires other modules to be installed before this +distribution's installer can be run. They can be found under the +"configure_requires" key of META.yml or the +"{prereqs}{configure}{requires}" key of META.json. + +## Other Prerequisites + +This distribution may require additional modules to be installed after running +Makefile.PL. +Look for prerequisites in the following phases: + +* to run make, PHASE = build +* to use the module code itself, PHASE = runtime +* to run tests, PHASE = test + +They can all be found in the "PHASE_requires" key of MYMETA.yml or the +"{prereqs}{PHASE}{requires}" key of MYMETA.json. + +## Documentation + +Try-Tiny documentation is available as POD. +You can run `perldoc` from a shell to read the documentation: + + % perldoc Try::Tiny + +For more information on installing Perl modules via CPAN, please see: +https://www.cpan.org/modules/INSTALL.html diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..fa48736 --- /dev/null +++ b/LICENCE @@ -0,0 +1,32 @@ +This software is Copyright (c) 2009 by יובל קוג'מן (Yuval Kogman). + +This is free software, licensed under: + + The MIT (X11) License + +The MIT License + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to +whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT +WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..b8a352e --- /dev/null +++ b/MANIFEST @@ -0,0 +1,40 @@ +# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.024. +CONTRIBUTING +Changes +INSTALL +LICENCE +MANIFEST +META.json +META.yml +Makefile.PL +README +dist.ini +lib/Try/Tiny.pm +maint/bench.pl +t/00-report-prereqs.dd +t/00-report-prereqs.t +t/basic.t +t/context.t +t/erroneous_usage.t +t/finally.t +t/given_when.t +t/global_destruction_forked.t +t/global_destruction_load.t +t/lib/TryUser.pm +t/named.t +t/when.t +t/zzz-check-breaks.t +xt/author/00-compile.t +xt/author/distmeta.t +xt/author/eol.t +xt/author/kwalitee.t +xt/author/minimum-version.t +xt/author/mojibake.t +xt/author/no-tabs.t +xt/author/pod-coverage.t +xt/author/pod-no404s.t +xt/author/pod-spell.t +xt/author/pod-syntax.t +xt/author/portability.t +xt/release/changes_has_content.t +xt/release/cpan-changes.t diff --git a/META.json b/META.json new file mode 100644 index 0000000..fb79930 --- /dev/null +++ b/META.json @@ -0,0 +1,1348 @@ +{ + "abstract" : "Minimal try/catch with proper preservation of $@", + "author" : [ + "\u05d9\u05d5\u05d1\u05dc \u05e7\u05d5\u05d2'\u05de\u05df (Yuval Kogman) ", + "Jesse Luehrs " + ], + "dynamic_config" : 0, + "generated_by" : "Dist::Zilla version 6.024, CPAN::Meta::Converter version 2.150010", + "license" : [ + "mit" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : 2 + }, + "name" : "Try-Tiny", + "no_index" : { + "directory" : [ + "t", + "xt" + ] + }, + "prereqs" : { + "configure" : { + "requires" : { + "ExtUtils::MakeMaker" : "0", + "perl" : "5.006" + }, + "suggests" : { + "JSON::PP" : "2.27300" + } + }, + "develop" : { + "recommends" : { + "Dist::Zilla::PluginBundle::Author::ETHER" : "0.161", + "Dist::Zilla::PluginBundle::Git::VersionManager" : "0.007" + }, + "requires" : { + "Capture::Tiny" : "0.12", + "Encode" : "0", + "File::Spec" : "0", + "IO::Handle" : "0", + "IPC::Open3" : "0", + "Pod::Coverage::TrustPod" : "0", + "Pod::Wordlist" : "0", + "Sub::Name" : "0.08", + "Sub::Util" : "0", + "Test::CPAN::Changes" : "0.19", + "Test::CPAN::Meta" : "0", + "Test::EOL" : "0", + "Test::Kwalitee" : "1.21", + "Test::MinimumVersion" : "0", + "Test::Mojibake" : "0", + "Test::More" : "0.96", + "Test::NoTabs" : "0", + "Test::Pod" : "1.41", + "Test::Pod::Coverage" : "1.08", + "Test::Pod::No404s" : "0", + "Test::Portability::Files" : "0", + "Test::Spelling" : "0.12" + } + }, + "runtime" : { + "requires" : { + "Carp" : "0", + "Exporter" : "5.57", + "constant" : "0", + "perl" : "5.006", + "strict" : "0", + "warnings" : "0" + }, + "suggests" : { + "Sub::Name" : "0.08", + "Sub::Util" : "0" + } + }, + "test" : { + "recommends" : { + "CPAN::Meta" : "2.120900" + }, + "requires" : { + "ExtUtils::MakeMaker" : "0", + "File::Spec" : "0", + "Test::More" : "0", + "if" : "0", + "perl" : "5.006" + }, + "suggests" : { + "CPAN::Meta::Check" : "0.011", + "CPAN::Meta::Requirements" : "0", + "Capture::Tiny" : "0.12" + } + }, + "x_Dist_Zilla" : { + "requires" : { + "Dist::Zilla" : "5", + "Dist::Zilla::Plugin::Authority" : "1.009", + "Dist::Zilla::Plugin::AutoMetaResources" : "0", + "Dist::Zilla::Plugin::AutoPrereqs" : "5.038", + "Dist::Zilla::Plugin::Breaks" : "0", + "Dist::Zilla::Plugin::BumpVersionAfterRelease::Transitional" : "0.004", + "Dist::Zilla::Plugin::CheckIssues" : "0", + "Dist::Zilla::Plugin::CheckMetaResources" : "0", + "Dist::Zilla::Plugin::CheckPrereqsIndexed" : "0.019", + "Dist::Zilla::Plugin::CheckSelfDependency" : "0", + "Dist::Zilla::Plugin::CheckStrictVersion" : "0", + "Dist::Zilla::Plugin::ConfirmRelease" : "0", + "Dist::Zilla::Plugin::CopyFilesFromRelease" : "0", + "Dist::Zilla::Plugin::EnsureLatestPerl" : "0", + "Dist::Zilla::Plugin::FileFinder::ByName" : "0", + "Dist::Zilla::Plugin::FileFinder::Filter" : "0", + "Dist::Zilla::Plugin::GenerateFile::FromShareDir" : "0", + "Dist::Zilla::Plugin::Git::Check" : "0", + "Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch" : "0.004", + "Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts" : "0", + "Dist::Zilla::Plugin::Git::Commit" : "2.020", + "Dist::Zilla::Plugin::Git::Contributors" : "0.029", + "Dist::Zilla::Plugin::Git::Describe" : "0.004", + "Dist::Zilla::Plugin::Git::GatherDir" : "2.016", + "Dist::Zilla::Plugin::Git::Push" : "0", + "Dist::Zilla::Plugin::Git::Remote::Check" : "0", + "Dist::Zilla::Plugin::Git::Tag" : "0", + "Dist::Zilla::Plugin::GitHub::Update" : "0.40", + "Dist::Zilla::Plugin::GithubMeta" : "0.54", + "Dist::Zilla::Plugin::InstallGuide" : "1.200005", + "Dist::Zilla::Plugin::Keywords" : "0.004", + "Dist::Zilla::Plugin::License" : "5.038", + "Dist::Zilla::Plugin::MakeMaker" : "0", + "Dist::Zilla::Plugin::Manifest" : "0", + "Dist::Zilla::Plugin::MetaConfig" : "0", + "Dist::Zilla::Plugin::MetaJSON" : "0", + "Dist::Zilla::Plugin::MetaNoIndex" : "0", + "Dist::Zilla::Plugin::MetaProvides::Package" : "1.15000002", + "Dist::Zilla::Plugin::MetaTests" : "0", + "Dist::Zilla::Plugin::MetaYAML" : "0", + "Dist::Zilla::Plugin::MinimumPerl" : "1.006", + "Dist::Zilla::Plugin::MojibakeTests" : "0.8", + "Dist::Zilla::Plugin::NextRelease" : "5.033", + "Dist::Zilla::Plugin::OnlyCorePrereqs" : "0", + "Dist::Zilla::Plugin::PodCoverageTests" : "5.040", + "Dist::Zilla::Plugin::PodSyntaxTests" : "5.040", + "Dist::Zilla::Plugin::PodWeaver" : "4.008", + "Dist::Zilla::Plugin::Prereqs" : "0", + "Dist::Zilla::Plugin::Prereqs::AuthorDeps" : "0.006", + "Dist::Zilla::Plugin::Prereqs::Soften" : "0", + "Dist::Zilla::Plugin::PromptIfStale" : "0", + "Dist::Zilla::Plugin::Readme" : "0", + "Dist::Zilla::Plugin::ReadmeAnyFromPod" : "0.142180", + "Dist::Zilla::Plugin::RewriteVersion::Transitional" : "0.006", + "Dist::Zilla::Plugin::Run::AfterBuild" : "0.041", + "Dist::Zilla::Plugin::Run::AfterRelease" : "0.038", + "Dist::Zilla::Plugin::RunExtraTests" : "0.024", + "Dist::Zilla::Plugin::StaticInstall" : "0.005", + "Dist::Zilla::Plugin::Substitute" : "0", + "Dist::Zilla::Plugin::Test::CPAN::Changes" : "0.012", + "Dist::Zilla::Plugin::Test::ChangesHasContent" : "0", + "Dist::Zilla::Plugin::Test::CheckBreaks" : "0.018", + "Dist::Zilla::Plugin::Test::Compile" : "2.039", + "Dist::Zilla::Plugin::Test::EOL" : "0.17", + "Dist::Zilla::Plugin::Test::Kwalitee" : "2.10", + "Dist::Zilla::Plugin::Test::MinimumVersion" : "2.000010", + "Dist::Zilla::Plugin::Test::NoTabs" : "0.08", + "Dist::Zilla::Plugin::Test::Pod::No404s" : "1.003", + "Dist::Zilla::Plugin::Test::PodSpelling" : "2.006003", + "Dist::Zilla::Plugin::Test::Portability" : "2.000007", + "Dist::Zilla::Plugin::Test::ReportPrereqs" : "0.022", + "Dist::Zilla::Plugin::TestRelease" : "0", + "Dist::Zilla::Plugin::UploadToCPAN" : "0", + "Dist::Zilla::Plugin::UseUnsafeInc" : "0", + "Dist::Zilla::PluginBundle::Author::ETHER" : "0.136", + "Dist::Zilla::PluginBundle::Git::VersionManager" : "0.007", + "Software::License::MIT" : "0" + } + } + }, + "provides" : { + "Try::Tiny" : { + "file" : "lib/Try/Tiny.pm", + "version" : "0.31" + } + }, + "release_status" : "stable", + "resources" : { + "bugtracker" : { + "mailto" : "bug-Try-Tiny@rt.cpan.org", + "web" : "https://rt.cpan.org/Public/Dist/Display.html?Name=Try-Tiny" + }, + "homepage" : "https://github.com/p5sagit/Try-Tiny", + "repository" : { + "type" : "git", + "url" : "https://github.com/p5sagit/Try-Tiny.git", + "web" : "https://github.com/p5sagit/Try-Tiny" + } + }, + "version" : "0.31", + "x_Dist_Zilla" : { + "perl" : { + "version" : "5.035006" + }, + "plugins" : [ + { + "class" : "Dist::Zilla::Plugin::FileFinder::Filter", + "name" : "all_files_but_using_5.10_features", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::Prereqs", + "config" : { + "Dist::Zilla::Plugin::Prereqs" : { + "phase" : "develop", + "type" : "recommends" + } + }, + "name" : "@Author::ETHER/pluginbundle version", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::PromptIfStale", + "config" : { + "Dist::Zilla::Plugin::PromptIfStale" : { + "check_all_plugins" : 0, + "check_all_prereqs" : 0, + "modules" : [ + "Dist::Zilla::PluginBundle::Author::ETHER" + ], + "phase" : "build", + "run_under_travis" : 0, + "skip" : [] + } + }, + "name" : "@Author::ETHER/stale modules, build", + "version" : "0.057" + }, + { + "class" : "Dist::Zilla::Plugin::FileFinder::ByName", + "name" : "@Author::ETHER/Examples", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::Git::GatherDir", + "config" : { + "Dist::Zilla::Plugin::GatherDir" : { + "exclude_filename" : [ + "CONTRIBUTING", + "INSTALL", + "LICENCE", + "README.pod" + ], + "exclude_match" : [], + "follow_symlinks" : 0, + "include_dotfiles" : 0, + "prefix" : "", + "prune_directory" : [], + "root" : "." + }, + "Dist::Zilla::Plugin::Git::GatherDir" : { + "include_untracked" : 0 + } + }, + "name" : "@Author::ETHER/Git::GatherDir", + "version" : "2.048" + }, + { + "class" : "Dist::Zilla::Plugin::MetaYAML", + "name" : "@Author::ETHER/MetaYAML", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::MetaJSON", + "name" : "@Author::ETHER/MetaJSON", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::Readme", + "name" : "@Author::ETHER/Readme", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::Manifest", + "name" : "@Author::ETHER/Manifest", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::License", + "name" : "@Author::ETHER/License", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::GenerateFile::FromShareDir", + "config" : { + "Dist::Zilla::Plugin::GenerateFile::FromShareDir" : { + "destination_filename" : "CONTRIBUTING", + "dist" : "Dist-Zilla-PluginBundle-Author-ETHER", + "encoding" : "UTF-8", + "has_xs" : 0, + "location" : "build", + "source_filename" : "CONTRIBUTING" + }, + "Dist::Zilla::Role::RepoFileInjector" : { + "allow_overwrite" : 1, + "repo_root" : ".", + "version" : "0.009" + } + }, + "name" : "@Author::ETHER/generate CONTRIBUTING", + "version" : "0.015" + }, + { + "class" : "Dist::Zilla::Plugin::InstallGuide", + "config" : { + "Dist::Zilla::Role::ModuleMetadata" : { + "Module::Metadata" : "1.000037", + "version" : "0.006" + } + }, + "name" : "@Author::ETHER/InstallGuide", + "version" : "1.200014" + }, + { + "class" : "Dist::Zilla::Plugin::Test::Compile", + "config" : { + "Dist::Zilla::Plugin::Test::Compile" : { + "bail_out_on_fail" : 1, + "fail_on_warning" : "author", + "fake_home" : 0, + "filename" : "xt/author/00-compile.t", + "module_finder" : [ + ":InstallModules" + ], + "needs_display" : 0, + "phase" : "develop", + "script_finder" : [ + ":PerlExecFiles", + "@Author::ETHER/Examples" + ], + "skips" : [], + "switch" : [] + } + }, + "name" : "@Author::ETHER/Test::Compile", + "version" : "2.058" + }, + { + "class" : "Dist::Zilla::Plugin::Test::NoTabs", + "config" : { + "Dist::Zilla::Plugin::Test::NoTabs" : { + "filename" : "xt/author/no-tabs.t", + "finder" : [ + ":InstallModules", + ":ExecFiles", + "@Author::ETHER/Examples", + ":TestFiles", + ":ExtraTestFiles" + ] + } + }, + "name" : "@Author::ETHER/Test::NoTabs", + "version" : "0.15" + }, + { + "class" : "Dist::Zilla::Plugin::Test::EOL", + "config" : { + "Dist::Zilla::Plugin::Test::EOL" : { + "filename" : "xt/author/eol.t", + "finder" : [ + ":ExecFiles", + ":ExtraTestFiles", + ":InstallModules", + ":TestFiles", + "@Author::ETHER/Examples" + ], + "trailing_whitespace" : 1 + } + }, + "name" : "@Author::ETHER/Test::EOL", + "version" : "0.19" + }, + { + "class" : "Dist::Zilla::Plugin::MetaTests", + "name" : "@Author::ETHER/MetaTests", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::Test::CPAN::Changes", + "config" : { + "Dist::Zilla::Plugin::Test::CPAN::Changes" : { + "changelog" : "Changes" + } + }, + "name" : "@Author::ETHER/Test::CPAN::Changes", + "version" : "0.012" + }, + { + "class" : "Dist::Zilla::Plugin::Test::ChangesHasContent", + "name" : "@Author::ETHER/Test::ChangesHasContent", + "version" : "0.011" + }, + { + "class" : "Dist::Zilla::Plugin::Test::MinimumVersion", + "config" : { + "Dist::Zilla::Plugin::Test::MinimumVersion" : { + "max_target_perl" : "5.006" + } + }, + "name" : "@Author::ETHER/Test::MinimumVersion", + "version" : "2.000010" + }, + { + "class" : "Dist::Zilla::Plugin::PodSyntaxTests", + "name" : "@Author::ETHER/PodSyntaxTests", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::PodCoverageTests", + "name" : "@Author::ETHER/PodCoverageTests", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::Test::PodSpelling", + "config" : { + "Dist::Zilla::Plugin::Test::PodSpelling" : { + "directories" : [ + "examples", + "lib", + "script", + "t", + "xt" + ], + "spell_cmd" : "", + "stopwords" : [ + "irc" + ], + "wordlist" : "Pod::Wordlist" + } + }, + "name" : "@Author::ETHER/Test::PodSpelling", + "version" : "2.007005" + }, + { + "class" : "Dist::Zilla::Plugin::Test::Pod::No404s", + "name" : "@Author::ETHER/Test::Pod::No404s", + "version" : "1.004" + }, + { + "class" : "Dist::Zilla::Plugin::Test::Kwalitee", + "config" : { + "Dist::Zilla::Plugin::Test::Kwalitee" : { + "filename" : "xt/author/kwalitee.t", + "skiptest" : [] + } + }, + "name" : "@Author::ETHER/Test::Kwalitee", + "version" : "2.12" + }, + { + "class" : "Dist::Zilla::Plugin::MojibakeTests", + "name" : "@Author::ETHER/MojibakeTests", + "version" : "0.8" + }, + { + "class" : "Dist::Zilla::Plugin::Test::ReportPrereqs", + "name" : "@Author::ETHER/Test::ReportPrereqs", + "version" : "0.028" + }, + { + "class" : "Dist::Zilla::Plugin::Test::Portability", + "config" : { + "Dist::Zilla::Plugin::Test::Portability" : { + "options" : "" + } + }, + "name" : "@Author::ETHER/Test::Portability", + "version" : "2.001000" + }, + { + "class" : "Dist::Zilla::Plugin::Git::Describe", + "name" : "@Author::ETHER/Git::Describe", + "version" : "0.007" + }, + { + "class" : "Dist::Zilla::Plugin::PodWeaver", + "config" : { + "Dist::Zilla::Plugin::PodWeaver" : { + "config_plugins" : [ + "@Author::ETHER" + ], + "finder" : [ + ":InstallModules", + ":ExecFiles" + ], + "plugins" : [ + { + "class" : "Pod::Weaver::Plugin::EnsurePod5", + "name" : "@Author::ETHER/EnsurePod5", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Plugin::H1Nester", + "name" : "@Author::ETHER/H1Nester", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Plugin::SingleEncoding", + "name" : "@Author::ETHER/SingleEncoding", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Plugin::Transformer", + "name" : "@Author::ETHER/List", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Plugin::Transformer", + "name" : "@Author::ETHER/Verbatim", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Section::Region", + "name" : "@Author::ETHER/header", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Section::Name", + "name" : "@Author::ETHER/Name", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Section::Version", + "name" : "@Author::ETHER/Version", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Section::Region", + "name" : "@Author::ETHER/prelude", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Section::Generic", + "name" : "SYNOPSIS", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Section::Generic", + "name" : "DESCRIPTION", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Section::Generic", + "name" : "OVERVIEW", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Section::Collect", + "name" : "ATTRIBUTES", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Section::Collect", + "name" : "METHODS", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Section::Collect", + "name" : "FUNCTIONS", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Section::Collect", + "name" : "TYPES", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Section::Leftovers", + "name" : "@Author::ETHER/Leftovers", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Section::Region", + "name" : "@Author::ETHER/postlude", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Section::GenerateSection", + "name" : "@Author::ETHER/generate SUPPORT", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Section::AllowOverride", + "name" : "@Author::ETHER/allow override SUPPORT", + "version" : "0.05" + }, + { + "class" : "Pod::Weaver::Section::Authors", + "name" : "@Author::ETHER/Authors", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Section::AllowOverride", + "name" : "@Author::ETHER/allow override AUTHOR", + "version" : "0.05" + }, + { + "class" : "Pod::Weaver::Section::Contributors", + "name" : "@Author::ETHER/Contributors", + "version" : "0.009" + }, + { + "class" : "Pod::Weaver::Section::Legal", + "name" : "@Author::ETHER/Legal", + "version" : "4.018" + }, + { + "class" : "Pod::Weaver::Section::Region", + "name" : "@Author::ETHER/footer", + "version" : "4.018" + } + ] + } + }, + "name" : "@Author::ETHER/PodWeaver", + "version" : "4.009" + }, + { + "class" : "Dist::Zilla::Plugin::GithubMeta", + "name" : "@Author::ETHER/GithubMeta", + "version" : "0.58" + }, + { + "class" : "Dist::Zilla::Plugin::AutoMetaResources", + "name" : "@Author::ETHER/AutoMetaResources", + "version" : "1.21" + }, + { + "class" : "Dist::Zilla::Plugin::Authority", + "name" : "@Author::ETHER/Authority", + "version" : "1.009" + }, + { + "class" : "Dist::Zilla::Plugin::MetaNoIndex", + "name" : "@Author::ETHER/MetaNoIndex", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::MetaProvides::Package", + "config" : { + "Dist::Zilla::Plugin::MetaProvides::Package" : { + "finder" : [ + ":InstallModules" + ], + "finder_objects" : [ + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":InstallModules", + "version" : "6.024" + } + ], + "include_underscores" : 0 + }, + "Dist::Zilla::Role::MetaProvider::Provider" : { + "$Dist::Zilla::Role::MetaProvider::Provider::VERSION" : "2.002004", + "inherit_missing" : 0, + "inherit_version" : 0, + "meta_noindex" : 1 + }, + "Dist::Zilla::Role::ModuleMetadata" : { + "Module::Metadata" : "1.000037", + "version" : "0.006" + } + }, + "name" : "@Author::ETHER/MetaProvides::Package", + "version" : "2.004003" + }, + { + "class" : "Dist::Zilla::Plugin::MetaConfig", + "name" : "@Author::ETHER/MetaConfig", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::Keywords", + "config" : { + "Dist::Zilla::Plugin::Keywords" : { + "keywords" : [] + } + }, + "name" : "@Author::ETHER/Keywords", + "version" : "0.007" + }, + { + "class" : "Dist::Zilla::Plugin::UseUnsafeInc", + "config" : { + "Dist::Zilla::Plugin::UseUnsafeInc" : { + "dot_in_INC" : 0 + } + }, + "name" : "@Author::ETHER/UseUnsafeInc", + "version" : "0.001" + }, + { + "class" : "Dist::Zilla::Plugin::AutoPrereqs", + "name" : "@Author::ETHER/AutoPrereqs", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::Prereqs::AuthorDeps", + "name" : "@Author::ETHER/Prereqs::AuthorDeps", + "version" : "0.007" + }, + { + "class" : "Dist::Zilla::Plugin::MinimumPerl", + "name" : "@Author::ETHER/MinimumPerl", + "version" : "1.006" + }, + { + "class" : "Dist::Zilla::Plugin::MakeMaker", + "config" : { + "Dist::Zilla::Role::TestRunner" : { + "default_jobs" : 9 + } + }, + "name" : "@Author::ETHER/MakeMaker", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::Git::Contributors", + "config" : { + "Dist::Zilla::Plugin::Git::Contributors" : { + "git_version" : "2.31.1", + "include_authors" : 0, + "include_releaser" : 1, + "order_by" : "commits", + "paths" : [] + } + }, + "name" : "@Author::ETHER/Git::Contributors", + "version" : "0.036" + }, + { + "class" : "Dist::Zilla::Plugin::StaticInstall", + "config" : { + "Dist::Zilla::Plugin::StaticInstall" : { + "dry_run" : 1, + "mode" : "auto" + } + }, + "name" : "@Author::ETHER/StaticInstall", + "version" : "0.012" + }, + { + "class" : "Dist::Zilla::Plugin::RunExtraTests", + "config" : { + "Dist::Zilla::Role::TestRunner" : { + "default_jobs" : 9 + } + }, + "name" : "@Author::ETHER/RunExtraTests", + "version" : "0.029" + }, + { + "class" : "Dist::Zilla::Plugin::CheckSelfDependency", + "config" : { + "Dist::Zilla::Plugin::CheckSelfDependency" : { + "finder" : [ + ":InstallModules" + ] + }, + "Dist::Zilla::Role::ModuleMetadata" : { + "Module::Metadata" : "1.000037", + "version" : "0.006" + } + }, + "name" : "@Author::ETHER/CheckSelfDependency", + "version" : "0.011" + }, + { + "class" : "Dist::Zilla::Plugin::Run::AfterBuild", + "config" : { + "Dist::Zilla::Plugin::Run::Role::Runner" : { + "fatal_errors" : 1, + "quiet" : 1, + "run" : [ + "bash -c \"test -e .ackrc && grep -q -- '--ignore-dir=.latest' .ackrc || echo '--ignore-dir=.latest' >> .ackrc; if [[ `dirname '%d'` != .build ]]; then test -e .ackrc && grep -q -- '--ignore-dir=%d' .ackrc || echo '--ignore-dir=%d' >> .ackrc; fi\"" + ], + "version" : "0.048" + } + }, + "name" : "@Author::ETHER/.ackrc", + "version" : "0.048" + }, + { + "class" : "Dist::Zilla::Plugin::Run::AfterBuild", + "config" : { + "Dist::Zilla::Plugin::Run::Role::Runner" : { + "eval" : [ + "if ('%d' =~ /^%n-[.[:xdigit:]]+$/) { unlink '.latest'; symlink '%d', '.latest'; }" + ], + "fatal_errors" : 0, + "quiet" : 1, + "version" : "0.048" + } + }, + "name" : "@Author::ETHER/.latest", + "version" : "0.048" + }, + { + "class" : "Dist::Zilla::Plugin::CheckStrictVersion", + "name" : "@Author::ETHER/CheckStrictVersion", + "version" : "0.001" + }, + { + "class" : "Dist::Zilla::Plugin::CheckMetaResources", + "name" : "@Author::ETHER/CheckMetaResources", + "version" : "0.001" + }, + { + "class" : "Dist::Zilla::Plugin::EnsureLatestPerl", + "config" : { + "Dist::Zilla::Plugin::EnsureLatestPerl" : { + "Module::CoreList" : "5.20211120" + } + }, + "name" : "@Author::ETHER/EnsureLatestPerl", + "version" : "0.008" + }, + { + "class" : "Dist::Zilla::Plugin::PromptIfStale", + "config" : { + "Dist::Zilla::Plugin::PromptIfStale" : { + "check_all_plugins" : 1, + "check_all_prereqs" : 1, + "modules" : [], + "phase" : "release", + "run_under_travis" : 0, + "skip" : [] + } + }, + "name" : "@Author::ETHER/stale modules, release", + "version" : "0.057" + }, + { + "class" : "Dist::Zilla::Plugin::Git::Check", + "config" : { + "Dist::Zilla::Plugin::Git::Check" : { + "untracked_files" : "die" + }, + "Dist::Zilla::Role::Git::DirtyFiles" : { + "allow_dirty" : [], + "allow_dirty_match" : [], + "changelog" : "Changes" + }, + "Dist::Zilla::Role::Git::Repo" : { + "git_version" : "2.31.1", + "repo_root" : "." + } + }, + "name" : "@Author::ETHER/initial check", + "version" : "2.048" + }, + { + "class" : "Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts", + "config" : { + "Dist::Zilla::Role::Git::Repo" : { + "git_version" : "2.31.1", + "repo_root" : "." + } + }, + "name" : "@Author::ETHER/Git::CheckFor::MergeConflicts", + "version" : "0.014" + }, + { + "class" : "Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch", + "config" : { + "Dist::Zilla::Role::Git::Repo" : { + "git_version" : "2.31.1", + "repo_root" : "." + } + }, + "name" : "@Author::ETHER/Git::CheckFor::CorrectBranch", + "version" : "0.014" + }, + { + "class" : "Dist::Zilla::Plugin::Git::Remote::Check", + "name" : "@Author::ETHER/Git::Remote::Check", + "version" : "0.1.2" + }, + { + "class" : "Dist::Zilla::Plugin::CheckPrereqsIndexed", + "name" : "@Author::ETHER/CheckPrereqsIndexed", + "version" : "0.021" + }, + { + "class" : "Dist::Zilla::Plugin::TestRelease", + "name" : "@Author::ETHER/TestRelease", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::Git::Check", + "config" : { + "Dist::Zilla::Plugin::Git::Check" : { + "untracked_files" : "die" + }, + "Dist::Zilla::Role::Git::DirtyFiles" : { + "allow_dirty" : [], + "allow_dirty_match" : [], + "changelog" : "Changes" + }, + "Dist::Zilla::Role::Git::Repo" : { + "git_version" : "2.31.1", + "repo_root" : "." + } + }, + "name" : "@Author::ETHER/after tests", + "version" : "2.048" + }, + { + "class" : "Dist::Zilla::Plugin::CheckIssues", + "name" : "@Author::ETHER/CheckIssues", + "version" : "0.011" + }, + { + "class" : "Dist::Zilla::Plugin::UploadToCPAN", + "name" : "@Author::ETHER/UploadToCPAN", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::CopyFilesFromRelease", + "config" : { + "Dist::Zilla::Plugin::CopyFilesFromRelease" : { + "filename" : [ + "CONTRIBUTING", + "INSTALL", + "LICENCE", + "LICENSE", + "ppport.h" + ], + "match" : [] + } + }, + "name" : "@Author::ETHER/copy generated files", + "version" : "0.007" + }, + { + "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod", + "config" : { + "Dist::Zilla::Role::FileWatcher" : { + "version" : "0.006" + } + }, + "name" : "@Author::ETHER/ReadmeAnyFromPod", + "version" : "0.163250" + }, + { + "class" : "Dist::Zilla::Plugin::Prereqs", + "config" : { + "Dist::Zilla::Plugin::Prereqs" : { + "phase" : "develop", + "type" : "recommends" + } + }, + "name" : "@Author::ETHER/@Git::VersionManager/pluginbundle version", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::RewriteVersion::Transitional", + "config" : { + "Dist::Zilla::Plugin::RewriteVersion" : { + "add_tarball_name" : 0, + "finders" : [ + ":ExecFiles", + ":InstallModules" + ], + "global" : 1, + "skip_version_provider" : 0 + }, + "Dist::Zilla::Plugin::RewriteVersion::Transitional" : {} + }, + "name" : "@Author::ETHER/@Git::VersionManager/RewriteVersion::Transitional", + "version" : "0.009" + }, + { + "class" : "Dist::Zilla::Plugin::MetaProvides::Update", + "name" : "@Author::ETHER/@Git::VersionManager/MetaProvides::Update", + "version" : "0.007" + }, + { + "class" : "Dist::Zilla::Plugin::CopyFilesFromRelease", + "config" : { + "Dist::Zilla::Plugin::CopyFilesFromRelease" : { + "filename" : [ + "Changes" + ], + "match" : [] + } + }, + "name" : "@Author::ETHER/@Git::VersionManager/CopyFilesFromRelease", + "version" : "0.007" + }, + { + "class" : "Dist::Zilla::Plugin::Git::Commit", + "config" : { + "Dist::Zilla::Plugin::Git::Commit" : { + "add_files_in" : [ + "." + ], + "commit_msg" : "%N-%v%t%n%n%c", + "signoff" : 0 + }, + "Dist::Zilla::Role::Git::DirtyFiles" : { + "allow_dirty" : [ + "CONTRIBUTING", + "Changes", + "INSTALL", + "LICENCE", + "README.pod" + ], + "allow_dirty_match" : [], + "changelog" : "Changes" + }, + "Dist::Zilla::Role::Git::Repo" : { + "git_version" : "2.31.1", + "repo_root" : "." + }, + "Dist::Zilla::Role::Git::StringFormatter" : { + "time_zone" : "local" + } + }, + "name" : "@Author::ETHER/@Git::VersionManager/release snapshot", + "version" : "2.048" + }, + { + "class" : "Dist::Zilla::Plugin::Git::Tag", + "config" : { + "Dist::Zilla::Plugin::Git::Tag" : { + "branch" : null, + "changelog" : "Changes", + "signed" : 0, + "tag" : "v0.31", + "tag_format" : "v%V", + "tag_message" : "v%v%t" + }, + "Dist::Zilla::Role::Git::Repo" : { + "git_version" : "2.31.1", + "repo_root" : "." + }, + "Dist::Zilla::Role::Git::StringFormatter" : { + "time_zone" : "local" + } + }, + "name" : "@Author::ETHER/@Git::VersionManager/Git::Tag", + "version" : "2.048" + }, + { + "class" : "Dist::Zilla::Plugin::BumpVersionAfterRelease::Transitional", + "config" : { + "Dist::Zilla::Plugin::BumpVersionAfterRelease" : { + "finders" : [ + ":InstallModules" + ], + "global" : 1, + "munge_makefile_pl" : 1 + }, + "Dist::Zilla::Plugin::BumpVersionAfterRelease::Transitional" : {} + }, + "name" : "@Author::ETHER/@Git::VersionManager/BumpVersionAfterRelease::Transitional", + "version" : "0.009" + }, + { + "class" : "Dist::Zilla::Plugin::NextRelease", + "name" : "@Author::ETHER/@Git::VersionManager/NextRelease", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::Git::Commit", + "config" : { + "Dist::Zilla::Plugin::Git::Commit" : { + "add_files_in" : [], + "commit_msg" : "increment $VERSION after %v release", + "signoff" : 0 + }, + "Dist::Zilla::Role::Git::DirtyFiles" : { + "allow_dirty" : [ + "Build.PL", + "Changes", + "Makefile.PL" + ], + "allow_dirty_match" : [ + "(?^:^lib/.*\\.pm$)" + ], + "changelog" : "Changes" + }, + "Dist::Zilla::Role::Git::Repo" : { + "git_version" : "2.31.1", + "repo_root" : "." + }, + "Dist::Zilla::Role::Git::StringFormatter" : { + "time_zone" : "local" + } + }, + "name" : "@Author::ETHER/@Git::VersionManager/post-release commit", + "version" : "2.048" + }, + { + "class" : "Dist::Zilla::Plugin::Prereqs", + "config" : { + "Dist::Zilla::Plugin::Prereqs" : { + "phase" : "x_Dist_Zilla", + "type" : "requires" + } + }, + "name" : "@Author::ETHER/@Git::VersionManager/prereqs for @Git::VersionManager", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::Git::Push", + "config" : { + "Dist::Zilla::Plugin::Git::Push" : { + "push_to" : [ + "origin" + ], + "remotes_must_exist" : 1 + }, + "Dist::Zilla::Role::Git::Repo" : { + "git_version" : "2.31.1", + "repo_root" : "." + } + }, + "name" : "@Author::ETHER/Git::Push", + "version" : "2.048" + }, + { + "class" : "Dist::Zilla::Plugin::GitHub::Update", + "config" : { + "Dist::Zilla::Plugin::GitHub::Update" : { + "metacpan" : 1 + } + }, + "name" : "@Author::ETHER/GitHub::Update", + "version" : "0.48" + }, + { + "class" : "Dist::Zilla::Plugin::Run::AfterRelease", + "config" : { + "Dist::Zilla::Plugin::Run::Role::Runner" : { + "fatal_errors" : 0, + "quiet" : 0, + "run" : [ + "REDACTED" + ], + "version" : "0.048" + } + }, + "name" : "@Author::ETHER/install release", + "version" : "0.048" + }, + { + "class" : "Dist::Zilla::Plugin::Run::AfterRelease", + "config" : { + "Dist::Zilla::Plugin::Run::Role::Runner" : { + "eval" : [ + "print \"release complete!\\xa\"" + ], + "fatal_errors" : 1, + "quiet" : 1, + "version" : "0.048" + } + }, + "name" : "@Author::ETHER/release complete", + "version" : "0.048" + }, + { + "class" : "Dist::Zilla::Plugin::ConfirmRelease", + "name" : "@Author::ETHER/ConfirmRelease", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::Prereqs", + "config" : { + "Dist::Zilla::Plugin::Prereqs" : { + "phase" : "x_Dist_Zilla", + "type" : "requires" + } + }, + "name" : "@Author::ETHER/prereqs for @Author::ETHER", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::Substitute", + "name" : "Substitute", + "version" : "0.006" + }, + { + "class" : "Dist::Zilla::Plugin::Prereqs::Soften", + "config" : { + "Dist::Zilla::Plugin::Prereqs::Soften" : { + "copy_to" : [ + "develop.requires" + ], + "modules" : [ + "Capture::Tiny", + "Sub::Name", + "Sub::Util" + ], + "modules_from_features" : null, + "to_relationship" : "suggests" + } + }, + "name" : "Prereqs::Soften", + "version" : "0.006003" + }, + { + "class" : "Dist::Zilla::Plugin::OnlyCorePrereqs", + "config" : { + "Dist::Zilla::Plugin::OnlyCorePrereqs" : { + "also_disallow" : [], + "check_dual_life_versions" : "0", + "deprecated_ok" : 0, + "phases" : [ + "configure", + "build", + "runtime", + "test" + ], + "skips" : [], + "starting_version" : "to be determined from perl prereq" + } + }, + "name" : "OnlyCorePrereqs", + "version" : "0.024" + }, + { + "class" : "Dist::Zilla::Plugin::Breaks", + "name" : "Breaks", + "version" : "0.004" + }, + { + "class" : "Dist::Zilla::Plugin::Test::CheckBreaks", + "config" : { + "Dist::Zilla::Plugin::Test::CheckBreaks" : { + "conflicts_module" : [], + "no_forced_deps" : 1 + }, + "Dist::Zilla::Role::ModuleMetadata" : { + "Module::Metadata" : "1.000037", + "version" : "0.006" + } + }, + "name" : "Test::CheckBreaks", + "version" : "0.019" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":InstallModules", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":IncModules", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":TestFiles", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":ExtraTestFiles", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":ExecFiles", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":PerlExecFiles", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":ShareFiles", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":MainModule", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":AllFiles", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":NoFiles", + "version" : "6.024" + }, + { + "class" : "Dist::Zilla::Plugin::VerifyPhases", + "name" : "@Author::ETHER/PHASE VERIFICATION", + "version" : "0.016" + } + ], + "zilla" : { + "class" : "Dist::Zilla::Dist::Builder", + "config" : { + "is_trial" : 0 + }, + "version" : "6.024" + } + }, + "x_authority" : "cpan:NUFFIN", + "x_breaks" : { + "Try::Tiny::Except" : "<= 0.01" + }, + "x_contributors" : [ + "Karen Etheridge ", + "Peter Rabbitson ", + "Ricardo Signes ", + "Mark Fowler ", + "Graham Knop ", + "Aristotle Pagaltzis ", + "Dagfinn Ilmari Manns\u00e5ker ", + "Lukas Mai ", + "Alex ", + "anaxagoras ", + "Andrew Yates ", + "awalker ", + "chromatic ", + "cm-perl ", + "David Lowe ", + "Glenn Fowler ", + "Hans Dieter Pearcey ", + "Jens Berthold ", + "Jonathan Yu ", + "Marc Mims ", + "Mark Stosberg ", + "Pali ", + "Paul Howarth ", + "Rudolf Leermakers " + ], + "x_generated_by_perl" : "v5.35.6", + "x_serialization_backend" : "Cpanel::JSON::XS version 4.27", + "x_spdx_expression" : "MIT", + "x_use_unsafe_inc" : 0 +} + diff --git a/META.yml b/META.yml new file mode 100644 index 0000000..9e5a476 --- /dev/null +++ b/META.yml @@ -0,0 +1,920 @@ +--- +abstract: 'Minimal try/catch with proper preservation of $@' +author: + - "יובל קוג'מן (Yuval Kogman) " + - 'Jesse Luehrs ' +build_requires: + ExtUtils::MakeMaker: '0' + File::Spec: '0' + Test::More: '0' + if: '0' + perl: '5.006' +configure_requires: + ExtUtils::MakeMaker: '0' + perl: '5.006' +dynamic_config: 0 +generated_by: 'Dist::Zilla version 6.024, CPAN::Meta::Converter version 2.150010' +license: mit +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: '1.4' +name: Try-Tiny +no_index: + directory: + - t + - xt +provides: + Try::Tiny: + file: lib/Try/Tiny.pm + version: '0.31' +requires: + Carp: '0' + Exporter: '5.57' + constant: '0' + perl: '5.006' + strict: '0' + warnings: '0' +resources: + bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Try-Tiny + homepage: https://github.com/p5sagit/Try-Tiny + repository: https://github.com/p5sagit/Try-Tiny.git +version: '0.31' +x_Dist_Zilla: + perl: + version: '5.035006' + plugins: + - + class: Dist::Zilla::Plugin::FileFinder::Filter + name: all_files_but_using_5.10_features + version: '6.024' + - + class: Dist::Zilla::Plugin::Prereqs + config: + Dist::Zilla::Plugin::Prereqs: + phase: develop + type: recommends + name: '@Author::ETHER/pluginbundle version' + version: '6.024' + - + class: Dist::Zilla::Plugin::PromptIfStale + config: + Dist::Zilla::Plugin::PromptIfStale: + check_all_plugins: 0 + check_all_prereqs: 0 + modules: + - Dist::Zilla::PluginBundle::Author::ETHER + phase: build + run_under_travis: 0 + skip: [] + name: '@Author::ETHER/stale modules, build' + version: '0.057' + - + class: Dist::Zilla::Plugin::FileFinder::ByName + name: '@Author::ETHER/Examples' + version: '6.024' + - + class: Dist::Zilla::Plugin::Git::GatherDir + config: + Dist::Zilla::Plugin::GatherDir: + exclude_filename: + - CONTRIBUTING + - INSTALL + - LICENCE + - README.pod + exclude_match: [] + follow_symlinks: 0 + include_dotfiles: 0 + prefix: '' + prune_directory: [] + root: . + Dist::Zilla::Plugin::Git::GatherDir: + include_untracked: 0 + name: '@Author::ETHER/Git::GatherDir' + version: '2.048' + - + class: Dist::Zilla::Plugin::MetaYAML + name: '@Author::ETHER/MetaYAML' + version: '6.024' + - + class: Dist::Zilla::Plugin::MetaJSON + name: '@Author::ETHER/MetaJSON' + version: '6.024' + - + class: Dist::Zilla::Plugin::Readme + name: '@Author::ETHER/Readme' + version: '6.024' + - + class: Dist::Zilla::Plugin::Manifest + name: '@Author::ETHER/Manifest' + version: '6.024' + - + class: Dist::Zilla::Plugin::License + name: '@Author::ETHER/License' + version: '6.024' + - + class: Dist::Zilla::Plugin::GenerateFile::FromShareDir + config: + Dist::Zilla::Plugin::GenerateFile::FromShareDir: + destination_filename: CONTRIBUTING + dist: Dist-Zilla-PluginBundle-Author-ETHER + encoding: UTF-8 + has_xs: 0 + location: build + source_filename: CONTRIBUTING + Dist::Zilla::Role::RepoFileInjector: + allow_overwrite: 1 + repo_root: . + version: '0.009' + name: '@Author::ETHER/generate CONTRIBUTING' + version: '0.015' + - + class: Dist::Zilla::Plugin::InstallGuide + config: + Dist::Zilla::Role::ModuleMetadata: + Module::Metadata: '1.000037' + version: '0.006' + name: '@Author::ETHER/InstallGuide' + version: '1.200014' + - + class: Dist::Zilla::Plugin::Test::Compile + config: + Dist::Zilla::Plugin::Test::Compile: + bail_out_on_fail: '1' + fail_on_warning: author + fake_home: 0 + filename: xt/author/00-compile.t + module_finder: + - ':InstallModules' + needs_display: 0 + phase: develop + script_finder: + - ':PerlExecFiles' + - '@Author::ETHER/Examples' + skips: [] + switch: [] + name: '@Author::ETHER/Test::Compile' + version: '2.058' + - + class: Dist::Zilla::Plugin::Test::NoTabs + config: + Dist::Zilla::Plugin::Test::NoTabs: + filename: xt/author/no-tabs.t + finder: + - ':InstallModules' + - ':ExecFiles' + - '@Author::ETHER/Examples' + - ':TestFiles' + - ':ExtraTestFiles' + name: '@Author::ETHER/Test::NoTabs' + version: '0.15' + - + class: Dist::Zilla::Plugin::Test::EOL + config: + Dist::Zilla::Plugin::Test::EOL: + filename: xt/author/eol.t + finder: + - ':ExecFiles' + - ':ExtraTestFiles' + - ':InstallModules' + - ':TestFiles' + - '@Author::ETHER/Examples' + trailing_whitespace: 1 + name: '@Author::ETHER/Test::EOL' + version: '0.19' + - + class: Dist::Zilla::Plugin::MetaTests + name: '@Author::ETHER/MetaTests' + version: '6.024' + - + class: Dist::Zilla::Plugin::Test::CPAN::Changes + config: + Dist::Zilla::Plugin::Test::CPAN::Changes: + changelog: Changes + name: '@Author::ETHER/Test::CPAN::Changes' + version: '0.012' + - + class: Dist::Zilla::Plugin::Test::ChangesHasContent + name: '@Author::ETHER/Test::ChangesHasContent' + version: '0.011' + - + class: Dist::Zilla::Plugin::Test::MinimumVersion + config: + Dist::Zilla::Plugin::Test::MinimumVersion: + max_target_perl: '5.006' + name: '@Author::ETHER/Test::MinimumVersion' + version: '2.000010' + - + class: Dist::Zilla::Plugin::PodSyntaxTests + name: '@Author::ETHER/PodSyntaxTests' + version: '6.024' + - + class: Dist::Zilla::Plugin::PodCoverageTests + name: '@Author::ETHER/PodCoverageTests' + version: '6.024' + - + class: Dist::Zilla::Plugin::Test::PodSpelling + config: + Dist::Zilla::Plugin::Test::PodSpelling: + directories: + - examples + - lib + - script + - t + - xt + spell_cmd: '' + stopwords: + - irc + wordlist: Pod::Wordlist + name: '@Author::ETHER/Test::PodSpelling' + version: '2.007005' + - + class: Dist::Zilla::Plugin::Test::Pod::No404s + name: '@Author::ETHER/Test::Pod::No404s' + version: '1.004' + - + class: Dist::Zilla::Plugin::Test::Kwalitee + config: + Dist::Zilla::Plugin::Test::Kwalitee: + filename: xt/author/kwalitee.t + skiptest: [] + name: '@Author::ETHER/Test::Kwalitee' + version: '2.12' + - + class: Dist::Zilla::Plugin::MojibakeTests + name: '@Author::ETHER/MojibakeTests' + version: '0.8' + - + class: Dist::Zilla::Plugin::Test::ReportPrereqs + name: '@Author::ETHER/Test::ReportPrereqs' + version: '0.028' + - + class: Dist::Zilla::Plugin::Test::Portability + config: + Dist::Zilla::Plugin::Test::Portability: + options: '' + name: '@Author::ETHER/Test::Portability' + version: '2.001000' + - + class: Dist::Zilla::Plugin::Git::Describe + name: '@Author::ETHER/Git::Describe' + version: '0.007' + - + class: Dist::Zilla::Plugin::PodWeaver + config: + Dist::Zilla::Plugin::PodWeaver: + config_plugins: + - '@Author::ETHER' + finder: + - ':InstallModules' + - ':ExecFiles' + plugins: + - + class: Pod::Weaver::Plugin::EnsurePod5 + name: '@Author::ETHER/EnsurePod5' + version: '4.018' + - + class: Pod::Weaver::Plugin::H1Nester + name: '@Author::ETHER/H1Nester' + version: '4.018' + - + class: Pod::Weaver::Plugin::SingleEncoding + name: '@Author::ETHER/SingleEncoding' + version: '4.018' + - + class: Pod::Weaver::Plugin::Transformer + name: '@Author::ETHER/List' + version: '4.018' + - + class: Pod::Weaver::Plugin::Transformer + name: '@Author::ETHER/Verbatim' + version: '4.018' + - + class: Pod::Weaver::Section::Region + name: '@Author::ETHER/header' + version: '4.018' + - + class: Pod::Weaver::Section::Name + name: '@Author::ETHER/Name' + version: '4.018' + - + class: Pod::Weaver::Section::Version + name: '@Author::ETHER/Version' + version: '4.018' + - + class: Pod::Weaver::Section::Region + name: '@Author::ETHER/prelude' + version: '4.018' + - + class: Pod::Weaver::Section::Generic + name: SYNOPSIS + version: '4.018' + - + class: Pod::Weaver::Section::Generic + name: DESCRIPTION + version: '4.018' + - + class: Pod::Weaver::Section::Generic + name: OVERVIEW + version: '4.018' + - + class: Pod::Weaver::Section::Collect + name: ATTRIBUTES + version: '4.018' + - + class: Pod::Weaver::Section::Collect + name: METHODS + version: '4.018' + - + class: Pod::Weaver::Section::Collect + name: FUNCTIONS + version: '4.018' + - + class: Pod::Weaver::Section::Collect + name: TYPES + version: '4.018' + - + class: Pod::Weaver::Section::Leftovers + name: '@Author::ETHER/Leftovers' + version: '4.018' + - + class: Pod::Weaver::Section::Region + name: '@Author::ETHER/postlude' + version: '4.018' + - + class: Pod::Weaver::Section::GenerateSection + name: '@Author::ETHER/generate SUPPORT' + version: '4.018' + - + class: Pod::Weaver::Section::AllowOverride + name: '@Author::ETHER/allow override SUPPORT' + version: '0.05' + - + class: Pod::Weaver::Section::Authors + name: '@Author::ETHER/Authors' + version: '4.018' + - + class: Pod::Weaver::Section::AllowOverride + name: '@Author::ETHER/allow override AUTHOR' + version: '0.05' + - + class: Pod::Weaver::Section::Contributors + name: '@Author::ETHER/Contributors' + version: '0.009' + - + class: Pod::Weaver::Section::Legal + name: '@Author::ETHER/Legal' + version: '4.018' + - + class: Pod::Weaver::Section::Region + name: '@Author::ETHER/footer' + version: '4.018' + name: '@Author::ETHER/PodWeaver' + version: '4.009' + - + class: Dist::Zilla::Plugin::GithubMeta + name: '@Author::ETHER/GithubMeta' + version: '0.58' + - + class: Dist::Zilla::Plugin::AutoMetaResources + name: '@Author::ETHER/AutoMetaResources' + version: '1.21' + - + class: Dist::Zilla::Plugin::Authority + name: '@Author::ETHER/Authority' + version: '1.009' + - + class: Dist::Zilla::Plugin::MetaNoIndex + name: '@Author::ETHER/MetaNoIndex' + version: '6.024' + - + class: Dist::Zilla::Plugin::MetaProvides::Package + config: + Dist::Zilla::Plugin::MetaProvides::Package: + finder: + - ':InstallModules' + finder_objects: + - + class: Dist::Zilla::Plugin::FinderCode + name: ':InstallModules' + version: '6.024' + include_underscores: 0 + Dist::Zilla::Role::MetaProvider::Provider: + $Dist::Zilla::Role::MetaProvider::Provider::VERSION: '2.002004' + inherit_missing: '0' + inherit_version: '0' + meta_noindex: '1' + Dist::Zilla::Role::ModuleMetadata: + Module::Metadata: '1.000037' + version: '0.006' + name: '@Author::ETHER/MetaProvides::Package' + version: '2.004003' + - + class: Dist::Zilla::Plugin::MetaConfig + name: '@Author::ETHER/MetaConfig' + version: '6.024' + - + class: Dist::Zilla::Plugin::Keywords + config: + Dist::Zilla::Plugin::Keywords: + keywords: [] + name: '@Author::ETHER/Keywords' + version: '0.007' + - + class: Dist::Zilla::Plugin::UseUnsafeInc + config: + Dist::Zilla::Plugin::UseUnsafeInc: + dot_in_INC: 0 + name: '@Author::ETHER/UseUnsafeInc' + version: '0.001' + - + class: Dist::Zilla::Plugin::AutoPrereqs + name: '@Author::ETHER/AutoPrereqs' + version: '6.024' + - + class: Dist::Zilla::Plugin::Prereqs::AuthorDeps + name: '@Author::ETHER/Prereqs::AuthorDeps' + version: '0.007' + - + class: Dist::Zilla::Plugin::MinimumPerl + name: '@Author::ETHER/MinimumPerl' + version: '1.006' + - + class: Dist::Zilla::Plugin::MakeMaker + config: + Dist::Zilla::Role::TestRunner: + default_jobs: 9 + name: '@Author::ETHER/MakeMaker' + version: '6.024' + - + class: Dist::Zilla::Plugin::Git::Contributors + config: + Dist::Zilla::Plugin::Git::Contributors: + git_version: 2.31.1 + include_authors: 0 + include_releaser: 1 + order_by: commits + paths: [] + name: '@Author::ETHER/Git::Contributors' + version: '0.036' + - + class: Dist::Zilla::Plugin::StaticInstall + config: + Dist::Zilla::Plugin::StaticInstall: + dry_run: 1 + mode: auto + name: '@Author::ETHER/StaticInstall' + version: '0.012' + - + class: Dist::Zilla::Plugin::RunExtraTests + config: + Dist::Zilla::Role::TestRunner: + default_jobs: 9 + name: '@Author::ETHER/RunExtraTests' + version: '0.029' + - + class: Dist::Zilla::Plugin::CheckSelfDependency + config: + Dist::Zilla::Plugin::CheckSelfDependency: + finder: + - ':InstallModules' + Dist::Zilla::Role::ModuleMetadata: + Module::Metadata: '1.000037' + version: '0.006' + name: '@Author::ETHER/CheckSelfDependency' + version: '0.011' + - + class: Dist::Zilla::Plugin::Run::AfterBuild + config: + Dist::Zilla::Plugin::Run::Role::Runner: + fatal_errors: 1 + quiet: 1 + run: + - "bash -c \"test -e .ackrc && grep -q -- '--ignore-dir=.latest' .ackrc || echo '--ignore-dir=.latest' >> .ackrc; if [[ `dirname '%d'` != .build ]]; then test -e .ackrc && grep -q -- '--ignore-dir=%d' .ackrc || echo '--ignore-dir=%d' >> .ackrc; fi\"" + version: '0.048' + name: '@Author::ETHER/.ackrc' + version: '0.048' + - + class: Dist::Zilla::Plugin::Run::AfterBuild + config: + Dist::Zilla::Plugin::Run::Role::Runner: + eval: + - "if ('%d' =~ /^%n-[.[:xdigit:]]+$/) { unlink '.latest'; symlink '%d', '.latest'; }" + fatal_errors: 0 + quiet: 1 + version: '0.048' + name: '@Author::ETHER/.latest' + version: '0.048' + - + class: Dist::Zilla::Plugin::CheckStrictVersion + name: '@Author::ETHER/CheckStrictVersion' + version: '0.001' + - + class: Dist::Zilla::Plugin::CheckMetaResources + name: '@Author::ETHER/CheckMetaResources' + version: '0.001' + - + class: Dist::Zilla::Plugin::EnsureLatestPerl + config: + Dist::Zilla::Plugin::EnsureLatestPerl: + Module::CoreList: '5.20211120' + name: '@Author::ETHER/EnsureLatestPerl' + version: '0.008' + - + class: Dist::Zilla::Plugin::PromptIfStale + config: + Dist::Zilla::Plugin::PromptIfStale: + check_all_plugins: 1 + check_all_prereqs: 1 + modules: [] + phase: release + run_under_travis: 0 + skip: [] + name: '@Author::ETHER/stale modules, release' + version: '0.057' + - + class: Dist::Zilla::Plugin::Git::Check + config: + Dist::Zilla::Plugin::Git::Check: + untracked_files: die + Dist::Zilla::Role::Git::DirtyFiles: + allow_dirty: [] + allow_dirty_match: [] + changelog: Changes + Dist::Zilla::Role::Git::Repo: + git_version: 2.31.1 + repo_root: . + name: '@Author::ETHER/initial check' + version: '2.048' + - + class: Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts + config: + Dist::Zilla::Role::Git::Repo: + git_version: 2.31.1 + repo_root: . + name: '@Author::ETHER/Git::CheckFor::MergeConflicts' + version: '0.014' + - + class: Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch + config: + Dist::Zilla::Role::Git::Repo: + git_version: 2.31.1 + repo_root: . + name: '@Author::ETHER/Git::CheckFor::CorrectBranch' + version: '0.014' + - + class: Dist::Zilla::Plugin::Git::Remote::Check + name: '@Author::ETHER/Git::Remote::Check' + version: 0.1.2 + - + class: Dist::Zilla::Plugin::CheckPrereqsIndexed + name: '@Author::ETHER/CheckPrereqsIndexed' + version: '0.021' + - + class: Dist::Zilla::Plugin::TestRelease + name: '@Author::ETHER/TestRelease' + version: '6.024' + - + class: Dist::Zilla::Plugin::Git::Check + config: + Dist::Zilla::Plugin::Git::Check: + untracked_files: die + Dist::Zilla::Role::Git::DirtyFiles: + allow_dirty: [] + allow_dirty_match: [] + changelog: Changes + Dist::Zilla::Role::Git::Repo: + git_version: 2.31.1 + repo_root: . + name: '@Author::ETHER/after tests' + version: '2.048' + - + class: Dist::Zilla::Plugin::CheckIssues + name: '@Author::ETHER/CheckIssues' + version: '0.011' + - + class: Dist::Zilla::Plugin::UploadToCPAN + name: '@Author::ETHER/UploadToCPAN' + version: '6.024' + - + class: Dist::Zilla::Plugin::CopyFilesFromRelease + config: + Dist::Zilla::Plugin::CopyFilesFromRelease: + filename: + - CONTRIBUTING + - INSTALL + - LICENCE + - LICENSE + - ppport.h + match: [] + name: '@Author::ETHER/copy generated files' + version: '0.007' + - + class: Dist::Zilla::Plugin::ReadmeAnyFromPod + config: + Dist::Zilla::Role::FileWatcher: + version: '0.006' + name: '@Author::ETHER/ReadmeAnyFromPod' + version: '0.163250' + - + class: Dist::Zilla::Plugin::Prereqs + config: + Dist::Zilla::Plugin::Prereqs: + phase: develop + type: recommends + name: '@Author::ETHER/@Git::VersionManager/pluginbundle version' + version: '6.024' + - + class: Dist::Zilla::Plugin::RewriteVersion::Transitional + config: + Dist::Zilla::Plugin::RewriteVersion: + add_tarball_name: 0 + finders: + - ':ExecFiles' + - ':InstallModules' + global: 1 + skip_version_provider: 0 + Dist::Zilla::Plugin::RewriteVersion::Transitional: {} + name: '@Author::ETHER/@Git::VersionManager/RewriteVersion::Transitional' + version: '0.009' + - + class: Dist::Zilla::Plugin::MetaProvides::Update + name: '@Author::ETHER/@Git::VersionManager/MetaProvides::Update' + version: '0.007' + - + class: Dist::Zilla::Plugin::CopyFilesFromRelease + config: + Dist::Zilla::Plugin::CopyFilesFromRelease: + filename: + - Changes + match: [] + name: '@Author::ETHER/@Git::VersionManager/CopyFilesFromRelease' + version: '0.007' + - + class: Dist::Zilla::Plugin::Git::Commit + config: + Dist::Zilla::Plugin::Git::Commit: + add_files_in: + - . + commit_msg: '%N-%v%t%n%n%c' + signoff: 0 + Dist::Zilla::Role::Git::DirtyFiles: + allow_dirty: + - CONTRIBUTING + - Changes + - INSTALL + - LICENCE + - README.pod + allow_dirty_match: [] + changelog: Changes + Dist::Zilla::Role::Git::Repo: + git_version: 2.31.1 + repo_root: . + Dist::Zilla::Role::Git::StringFormatter: + time_zone: local + name: '@Author::ETHER/@Git::VersionManager/release snapshot' + version: '2.048' + - + class: Dist::Zilla::Plugin::Git::Tag + config: + Dist::Zilla::Plugin::Git::Tag: + branch: ~ + changelog: Changes + signed: 0 + tag: v0.31 + tag_format: v%V + tag_message: v%v%t + Dist::Zilla::Role::Git::Repo: + git_version: 2.31.1 + repo_root: . + Dist::Zilla::Role::Git::StringFormatter: + time_zone: local + name: '@Author::ETHER/@Git::VersionManager/Git::Tag' + version: '2.048' + - + class: Dist::Zilla::Plugin::BumpVersionAfterRelease::Transitional + config: + Dist::Zilla::Plugin::BumpVersionAfterRelease: + finders: + - ':InstallModules' + global: 1 + munge_makefile_pl: 1 + Dist::Zilla::Plugin::BumpVersionAfterRelease::Transitional: {} + name: '@Author::ETHER/@Git::VersionManager/BumpVersionAfterRelease::Transitional' + version: '0.009' + - + class: Dist::Zilla::Plugin::NextRelease + name: '@Author::ETHER/@Git::VersionManager/NextRelease' + version: '6.024' + - + class: Dist::Zilla::Plugin::Git::Commit + config: + Dist::Zilla::Plugin::Git::Commit: + add_files_in: [] + commit_msg: 'increment $VERSION after %v release' + signoff: 0 + Dist::Zilla::Role::Git::DirtyFiles: + allow_dirty: + - Build.PL + - Changes + - Makefile.PL + allow_dirty_match: + - (?^:^lib/.*\.pm$) + changelog: Changes + Dist::Zilla::Role::Git::Repo: + git_version: 2.31.1 + repo_root: . + Dist::Zilla::Role::Git::StringFormatter: + time_zone: local + name: '@Author::ETHER/@Git::VersionManager/post-release commit' + version: '2.048' + - + class: Dist::Zilla::Plugin::Prereqs + config: + Dist::Zilla::Plugin::Prereqs: + phase: x_Dist_Zilla + type: requires + name: '@Author::ETHER/@Git::VersionManager/prereqs for @Git::VersionManager' + version: '6.024' + - + class: Dist::Zilla::Plugin::Git::Push + config: + Dist::Zilla::Plugin::Git::Push: + push_to: + - origin + remotes_must_exist: 1 + Dist::Zilla::Role::Git::Repo: + git_version: 2.31.1 + repo_root: . + name: '@Author::ETHER/Git::Push' + version: '2.048' + - + class: Dist::Zilla::Plugin::GitHub::Update + config: + Dist::Zilla::Plugin::GitHub::Update: + metacpan: 1 + name: '@Author::ETHER/GitHub::Update' + version: '0.48' + - + class: Dist::Zilla::Plugin::Run::AfterRelease + config: + Dist::Zilla::Plugin::Run::Role::Runner: + fatal_errors: 0 + quiet: 0 + run: + - REDACTED + version: '0.048' + name: '@Author::ETHER/install release' + version: '0.048' + - + class: Dist::Zilla::Plugin::Run::AfterRelease + config: + Dist::Zilla::Plugin::Run::Role::Runner: + eval: + - 'print "release complete!\xa"' + fatal_errors: 1 + quiet: 1 + version: '0.048' + name: '@Author::ETHER/release complete' + version: '0.048' + - + class: Dist::Zilla::Plugin::ConfirmRelease + name: '@Author::ETHER/ConfirmRelease' + version: '6.024' + - + class: Dist::Zilla::Plugin::Prereqs + config: + Dist::Zilla::Plugin::Prereqs: + phase: x_Dist_Zilla + type: requires + name: '@Author::ETHER/prereqs for @Author::ETHER' + version: '6.024' + - + class: Dist::Zilla::Plugin::Substitute + name: Substitute + version: '0.006' + - + class: Dist::Zilla::Plugin::Prereqs::Soften + config: + Dist::Zilla::Plugin::Prereqs::Soften: + copy_to: + - develop.requires + modules: + - Capture::Tiny + - Sub::Name + - Sub::Util + modules_from_features: ~ + to_relationship: suggests + name: Prereqs::Soften + version: '0.006003' + - + class: Dist::Zilla::Plugin::OnlyCorePrereqs + config: + Dist::Zilla::Plugin::OnlyCorePrereqs: + also_disallow: [] + check_dual_life_versions: '0' + deprecated_ok: '0' + phases: + - configure + - build + - runtime + - test + skips: [] + starting_version: 'to be determined from perl prereq' + name: OnlyCorePrereqs + version: '0.024' + - + class: Dist::Zilla::Plugin::Breaks + name: Breaks + version: '0.004' + - + class: Dist::Zilla::Plugin::Test::CheckBreaks + config: + Dist::Zilla::Plugin::Test::CheckBreaks: + conflicts_module: [] + no_forced_deps: 1 + Dist::Zilla::Role::ModuleMetadata: + Module::Metadata: '1.000037' + version: '0.006' + name: Test::CheckBreaks + version: '0.019' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':InstallModules' + version: '6.024' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':IncModules' + version: '6.024' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':TestFiles' + version: '6.024' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':ExtraTestFiles' + version: '6.024' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':ExecFiles' + version: '6.024' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':PerlExecFiles' + version: '6.024' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':ShareFiles' + version: '6.024' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':MainModule' + version: '6.024' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':AllFiles' + version: '6.024' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':NoFiles' + version: '6.024' + - + class: Dist::Zilla::Plugin::VerifyPhases + name: '@Author::ETHER/PHASE VERIFICATION' + version: '0.016' + zilla: + class: Dist::Zilla::Dist::Builder + config: + is_trial: '0' + version: '6.024' +x_authority: cpan:NUFFIN +x_breaks: + Try::Tiny::Except: '<= 0.01' +x_contributors: + - 'Karen Etheridge ' + - 'Peter Rabbitson ' + - 'Ricardo Signes ' + - 'Mark Fowler ' + - 'Graham Knop ' + - 'Aristotle Pagaltzis ' + - 'Dagfinn Ilmari Mannsåker ' + - 'Lukas Mai ' + - 'Alex ' + - 'anaxagoras ' + - 'Andrew Yates ' + - 'awalker ' + - 'chromatic ' + - 'cm-perl ' + - 'David Lowe ' + - 'Glenn Fowler ' + - 'Hans Dieter Pearcey ' + - 'Jens Berthold ' + - 'Jonathan Yu ' + - 'Marc Mims ' + - 'Mark Stosberg ' + - 'Pali ' + - 'Paul Howarth ' + - 'Rudolf Leermakers ' +x_generated_by_perl: v5.35.6 +x_serialization_backend: 'YAML::Tiny version 1.73' +x_spdx_expression: MIT +x_use_unsafe_inc: 0 diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..df58c95 --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,61 @@ +# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.024. +use strict; +use warnings; + +use 5.006; + +use ExtUtils::MakeMaker; + +my %WriteMakefileArgs = ( + "ABSTRACT" => "Minimal try/catch with proper preservation of \$\@", + "AUTHOR" => "\x{5d9}\x{5d5}\x{5d1}\x{5dc} \x{5e7}\x{5d5}\x{5d2}'\x{5de}\x{5df} (Yuval Kogman) , Jesse Luehrs ", + "CONFIGURE_REQUIRES" => { + "ExtUtils::MakeMaker" => 0 + }, + "DISTNAME" => "Try-Tiny", + "LICENSE" => "mit", + "MIN_PERL_VERSION" => "5.006", + "NAME" => "Try::Tiny", + "PREREQ_PM" => { + "Carp" => 0, + "Exporter" => "5.57", + "constant" => 0, + "strict" => 0, + "warnings" => 0 + }, + "TEST_REQUIRES" => { + "ExtUtils::MakeMaker" => 0, + "File::Spec" => 0, + "Test::More" => 0, + "if" => 0 + }, + "VERSION" => "0.31", + "test" => { + "TESTS" => "t/*.t" + } +); + + +my %FallbackPrereqs = ( + "Carp" => 0, + "Exporter" => "5.57", + "ExtUtils::MakeMaker" => 0, + "File::Spec" => 0, + "Test::More" => 0, + "constant" => 0, + "if" => 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..2b77579 --- /dev/null +++ b/README @@ -0,0 +1,13 @@ +This archive contains the distribution Try-Tiny, +version 0.31: + + Minimal try/catch with proper preservation of $@ + +This software is Copyright (c) 2009 by יובל קוג'מן (Yuval Kogman). + +This is free software, licensed under: + + The MIT (X11) License + + +This README file was generated by Dist::Zilla::Plugin::Readme v6.024. diff --git a/dist.ini b/dist.ini new file mode 100644 index 0000000..4533f3c --- /dev/null +++ b/dist.ini @@ -0,0 +1,47 @@ +name = Try-Tiny +author = יובל קוג'מן (Yuval Kogman) +author = Jesse Luehrs +license = MIT +copyright_holder = יובל קוג'מן (Yuval Kogman) +copyright_year = 2009 + +[FileFinder::Filter / all_files_but_using_5.10_features] +finder = :TestFiles +skip = t/given_when.t +skip = t/when.t + +[@Author::ETHER] +:version = 0.136 +; instead of using the remote: origin = p5sagit@git.shadowcat.co.uk:Sub-Name.git, +; use the read-only mirror remote: github = git@github.com:p5sagit/Sub-Name.git +; so we can receive github pull requests +server = github +GithubMeta.remote = github +installer = MakeMaker ; stay 5.6-friendly +authority = cpan:NUFFIN +; tests optionally require 5.010 +AutoPrereqs.skip = ^perl$ +MinimumPerl.test_finder = all_files_but_using_5.10_features +-remove = Test::CleanNamespaces + +; TODO: make this an option of [Test::MinimumVersion] +[Substitute] +file = xt/author/minimum-version.t +code = s/^(all_minimum_version_ok\([^)]+)(\s*\);)/$1, { skip => [qw(t\/given_when\.t t\/when\.t)] }$2/ + +[Prereqs::Soften] +to_relationship = suggests +copy_to = develop.requires +module = Capture::Tiny ; capture_stderr +module = Sub::Name +module = Sub::Util + +[OnlyCorePrereqs] +check_dual_life_versions = 0 + +[Breaks] +Try::Tiny::Except = <= 0.01 ; https://github.com/tfoertsch/perl-Try-Tiny-Except/issues/1 + +[Test::CheckBreaks] +:version = 0.018 +no_forced_deps = 1 diff --git a/lib/Try/Tiny.pm b/lib/Try/Tiny.pm new file mode 100644 index 0000000..6b5eb4e --- /dev/null +++ b/lib/Try/Tiny.pm @@ -0,0 +1,820 @@ +package Try::Tiny; # git description: v0.30-11-g1b81d0a +use 5.006; +# ABSTRACT: Minimal try/catch with proper preservation of $@ + +our $VERSION = '0.31'; + +use strict; +use warnings; + +use Exporter 5.57 'import'; +our @EXPORT = our @EXPORT_OK = qw(try catch finally); + +use Carp; +$Carp::Internal{+__PACKAGE__}++; + +BEGIN { + my $su = $INC{'Sub/Util.pm'} && defined &Sub::Util::set_subname; + my $sn = $INC{'Sub/Name.pm'} && eval { Sub::Name->VERSION(0.08) }; + unless ($su || $sn) { + $su = eval { require Sub::Util; } && defined &Sub::Util::set_subname; + unless ($su) { + $sn = eval { require Sub::Name; Sub::Name->VERSION(0.08) }; + } + } + + *_subname = $su ? \&Sub::Util::set_subname + : $sn ? \&Sub::Name::subname + : sub { $_[1] }; + *_HAS_SUBNAME = ($su || $sn) ? sub(){1} : sub(){0}; +} + +my %_finally_guards; + +# Need to prototype as @ not $$ because of the way Perl evaluates the prototype. +# Keeping it at $$ means you only ever get 1 sub because we need to eval in a list +# context & not a scalar one + +sub try (&;@) { + my ( $try, @code_refs ) = @_; + + # we need to save this here, the eval block will be in scalar context due + # to $failed + my $wantarray = wantarray; + + # work around perl bug by explicitly initializing these, due to the likelyhood + # this will be used in global destruction (perl rt#119311) + my ( $catch, @finally ) = (); + + # find labeled blocks in the argument list. + # catch and finally tag the blocks by blessing a scalar reference to them. + foreach my $code_ref (@code_refs) { + + if ( ref($code_ref) eq 'Try::Tiny::Catch' ) { + croak 'A try() may not be followed by multiple catch() blocks' + if $catch; + $catch = ${$code_ref}; + } elsif ( ref($code_ref) eq 'Try::Tiny::Finally' ) { + push @finally, ${$code_ref}; + } else { + croak( + 'try() encountered an unexpected argument (' + . ( defined $code_ref ? $code_ref : 'undef' ) + . ') - perhaps a missing semi-colon before or' + ); + } + } + + # FIXME consider using local $SIG{__DIE__} to accumulate all errors. It's + # not perfect, but we could provide a list of additional errors for + # $catch->(); + + # name the blocks if we have Sub::Name installed + _subname(caller().'::try {...} ' => $try) + if _HAS_SUBNAME; + + # set up scope guards to invoke the finally blocks at the end. + # this should really be a function scope lexical variable instead of + # file scope + local but that causes issues with perls < 5.20 due to + # perl rt#119311 + local $_finally_guards{guards} = [ + map Try::Tiny::ScopeGuard->_new($_), + @finally + ]; + + # save the value of $@ so we can set $@ back to it in the beginning of the eval + # and restore $@ after the eval finishes + my $prev_error = $@; + + my ( @ret, $error ); + + # failed will be true if the eval dies, because 1 will not be returned + # from the eval body + my $failed = not eval { + $@ = $prev_error; + + # evaluate the try block in the correct context + if ( $wantarray ) { + @ret = $try->(); + } elsif ( defined $wantarray ) { + $ret[0] = $try->(); + } else { + $try->(); + }; + + return 1; # properly set $failed to false + }; + + # preserve the current error and reset the original value of $@ + $error = $@; + $@ = $prev_error; + + # at this point $failed contains a true value if the eval died, even if some + # destructor overwrote $@ as the eval was unwinding. + if ( $failed ) { + # pass $error to the finally blocks + push @$_, $error for @{$_finally_guards{guards}}; + + # if we got an error, invoke the catch block. + if ( $catch ) { + # This works like given($error), but is backwards compatible and + # sets $_ in the dynamic scope for the body of C<$catch> + for ($error) { + return $catch->($error); + } + + # in case when() was used without an explicit return, the C + # loop will be aborted and there's no useful return value + } + + return; + } else { + # no failure, $@ is back to what it was, everything is fine + return $wantarray ? @ret : $ret[0]; + } +} + +sub catch (&;@) { + my ( $block, @rest ) = @_; + + croak 'Useless bare catch()' unless wantarray; + + _subname(caller().'::catch {...} ' => $block) + if _HAS_SUBNAME; + return ( + bless(\$block, 'Try::Tiny::Catch'), + @rest, + ); +} + +sub finally (&;@) { + my ( $block, @rest ) = @_; + + croak 'Useless bare finally()' unless wantarray; + + _subname(caller().'::finally {...} ' => $block) + if _HAS_SUBNAME; + return ( + bless(\$block, 'Try::Tiny::Finally'), + @rest, + ); +} + +{ + package # hide from PAUSE + Try::Tiny::ScopeGuard; + + use constant UNSTABLE_DOLLARAT => ("$]" < '5.013002') ? 1 : 0; + + sub _new { + shift; + bless [ @_ ]; + } + + sub DESTROY { + my ($code, @args) = @{ $_[0] }; + + local $@ if UNSTABLE_DOLLARAT; + eval { + $code->(@args); + 1; + } or do { + warn + "Execution of finally() block $code resulted in an exception, which " + . '*CAN NOT BE PROPAGATED* due to fundamental limitations of Perl. ' + . 'Your program will continue as if this event never took place. ' + . "Original exception text follows:\n\n" + . (defined $@ ? $@ : '$@ left undefined...') + . "\n" + ; + } + } +} + +__PACKAGE__ + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Try::Tiny - Minimal try/catch with proper preservation of $@ + +=head1 VERSION + +version 0.31 + +=head1 SYNOPSIS + +You can use Try::Tiny's C and C to expect and handle exceptional +conditions, avoiding quirks in Perl and common mistakes: + + # handle errors with a catch handler + try { + die "foo"; + } catch { + warn "caught error: $_"; # not $@ + }; + +You can also use it like a standalone C to catch and ignore any error +conditions. Obviously, this is an extreme measure not to be undertaken +lightly: + + # just silence errors + try { + die "foo"; + }; + +=head1 DESCRIPTION + +This module provides bare bones C/C/C statements that are designed to +minimize common mistakes with eval blocks, and NOTHING else. + +This is unlike L which provides a nice syntax and avoids adding +another call stack layer, and supports calling C from the C block to +return from the parent subroutine. These extra features come at a cost of a few +dependencies, namely L and L which are +occasionally problematic, and the additional catch filtering uses L +type constraints which may not be desirable either. + +The main focus of this module is to provide simple and reliable error handling +for those having a hard time installing L, but who still want to +write correct C blocks without 5 lines of boilerplate each time. + +It's designed to work as correctly as possible in light of the various +pathological edge cases (see L) and to be compatible with any style +of error values (simple strings, references, objects, overloaded objects, etc). + +If the C block dies, it returns the value of the last statement executed in +the C block, if there is one. Otherwise, it returns C in scalar +context or the empty list in list context. The following examples all +assign C<"bar"> to C<$x>: + + my $x = try { die "foo" } catch { "bar" }; + my $x = try { die "foo" } || "bar"; + my $x = (try { die "foo" }) // "bar"; + + my $x = eval { die "foo" } || "bar"; + +You can add C blocks, yielding the following: + + my $x; + try { die 'foo' } finally { $x = 'bar' }; + try { die 'foo' } catch { warn "Got a die: $_" } finally { $x = 'bar' }; + +C blocks are always executed making them suitable for cleanup code +which cannot be handled using local. You can add as many C blocks to a +given C block as you like. + +Note that adding a C block without a preceding C block +suppresses any errors. This behaviour is consistent with using a standalone +C, but it is not consistent with C/C patterns found in +other programming languages, such as Java, Python, Javascript or C#. If you +learned the C/C pattern from one of these languages, watch out for +this. + +=head1 EXPORTS + +All functions are exported by default using L. + +If you need to rename the C, C or C keyword consider using +L to get L's flexibility. + +=over 4 + +=item try (&;@) + +Takes one mandatory C subroutine, an optional C subroutine and C +subroutine. + +The mandatory subroutine is evaluated in the context of an C block. + +If no error occurred the value from the first block is returned, preserving +list/scalar context. + +If there was an error and the second subroutine was given it will be invoked +with the error in C<$_> (localized) and as that block's first and only +argument. + +C<$@> does B contain the error. Inside the C block it has the same +value it had before the C block was executed. + +Note that the error may be false, but if that happens the C block will +still be invoked. + +Once all execution is finished then the C block, if given, will execute. + +=item catch (&;@) + +Intended to be used in the second argument position of C. + +Returns a reference to the subroutine it was given but blessed as +C which allows try to decode correctly what to do +with this code reference. + + catch { ... } + +Inside the C block the caught error is stored in C<$_>, while previous +value of C<$@> is still available for use. This value may or may not be +meaningful depending on what happened before the C, but it might be a good +idea to preserve it in an error stack. + +For code that captures C<$@> when throwing new errors (i.e. +L), you'll need to do: + + local $@ = $_; + +=item finally (&;@) + + try { ... } + catch { ... } + finally { ... }; + +Or + + try { ... } + finally { ... }; + +Or even + + try { ... } + finally { ... } + catch { ... }; + +Intended to be the second or third element of C. C blocks are always +executed in the event of a successful C or if C is run. This allows +you to locate cleanup code which cannot be done via C e.g. closing a file +handle. + +When invoked, the C block is passed the error that was caught. If no +error was caught, it is passed nothing. (Note that the C block does not +localize C<$_> with the error, since unlike in a C block, there is no way +to know if C<$_ == undef> implies that there were no errors.) In other words, +the following code does just what you would expect: + + try { + die_sometimes(); + } catch { + # ...code run in case of error + } finally { + if (@_) { + print "The try block died with: @_\n"; + } else { + print "The try block ran without error.\n"; + } + }; + +B block>. C will +not do anything about handling possible errors coming from code located in these +blocks. + +Furthermore B blocks are not trappable and are unable +to influence the execution of your program>. This is due to limitation of +C-based scope guards, which C is implemented on top of. This +may change in a future version of Try::Tiny. + +In the same way C blesses the code reference this subroutine does the same +except it bless them as C. + +=back + +=head1 BACKGROUND + +There are a number of issues with C. + +=head2 Clobbering $@ + +When you run an C block and it succeeds, C<$@> will be cleared, potentially +clobbering an error that is currently being caught. + +This causes action at a distance, clearing previous errors your caller may have +not yet handled. + +C<$@> must be properly localized before invoking C in order to avoid this +issue. + +More specifically, +L +C<$@> was clobbered at the beginning of the C, which +also made it impossible to capture the previous error before you die (for +instance when making exception objects with error stacks). + +For this reason C will actually set C<$@> to its previous value (the one +available before entering the C block) in the beginning of the C +block. + +=head2 Localizing $@ silently masks errors + +Inside an C block, C behaves sort of like: + + sub die { + $@ = $_[0]; + return_undef_from_eval(); + } + +This means that if you were polite and localized C<$@> you can't die in that +scope, or your error will be discarded (printing "Something's wrong" instead). + +The workaround is very ugly: + + my $error = do { + local $@; + eval { ... }; + $@; + }; + + ... + die $error; + +=head2 $@ might not be a true value + +This code is wrong: + + if ( $@ ) { + ... + } + +because due to the previous caveats it may have been unset. + +C<$@> could also be an overloaded error object that evaluates to false, but +that's asking for trouble anyway. + +The classic failure mode (fixed in L) is: + + sub Object::DESTROY { + eval { ... } + } + + eval { + my $obj = Object->new; + + die "foo"; + }; + + if ( $@ ) { + + } + +In this case since C is not localizing C<$@> but still uses +C, it will set C<$@> to C<"">. + +The destructor is called when the stack is unwound, after C sets C<$@> to +C<"foo at Foo.pm line 42\n">, so by the time C is evaluated it has +been cleared by C in the destructor. + +The workaround for this is even uglier than the previous ones. Even though we +can't save the value of C<$@> from code that doesn't localize, we can at least +be sure the C was aborted due to an error: + + my $failed = not eval { + ... + + return 1; + }; + +This is because an C that caught a C will always return a false +value. + +=head1 ALTERNATE SYNTAX + +Using Perl 5.10 you can use L (but please don't, +because that syntax has since been deprecated because there was too much +unexpected magical behaviour). + +=for stopwords topicalizer + +The C block is invoked in a topicalizer context (like a C block), +but note that you can't return a useful value from C using the C +blocks without an explicit C. + +This is somewhat similar to Perl 6's C blocks. You can use it to +concisely match errors: + + try { + require Foo; + } catch { + when (/^Can't locate .*?\.pm in \@INC/) { } # ignore + default { die $_ } + }; + +=head1 CAVEATS + +=over 4 + +=item * + +C<@_> is not available within the C block, so you need to copy your +argument list. In case you want to work with argument values directly via C<@_> +aliasing (i.e. allow C<$_[1] = "foo">), you need to pass C<@_> by reference: + + sub foo { + my ( $self, @args ) = @_; + try { $self->bar(@args) } + } + +or + + sub bar_in_place { + my $self = shift; + my $args = \@_; + try { $_ = $self->bar($_) for @$args } + } + +=item * + +C returns from the C block, not from the parent sub (note that +this is also how C works, but not how L works): + + sub parent_sub { + try { + die; + } + catch { + return; + }; + + say "this text WILL be displayed, even though an exception is thrown"; + } + +Instead, you should capture the return value: + + sub parent_sub { + my $success = try { + die; + 1; + }; + return unless $success; + + say "This text WILL NEVER appear!"; + } + # OR + sub parent_sub_with_catch { + my $success = try { + die; + 1; + } + catch { + # do something with $_ + return undef; #see note + }; + return unless $success; + + say "This text WILL NEVER appear!"; + } + +Note that if you have a C block, it must return C for this to work, +since if a C block exists, its return value is returned in place of C +when an exception is thrown. + +=item * + +C introduces another caller stack frame. L is not used. L +will not report this when using full stack traces, though, because +C<%Carp::Internal> is used. This lack of magic is considered a feature. + +=for stopwords unhygienically + +=item * + +The value of C<$_> in the C block is not guaranteed to be the value of +the exception thrown (C<$@>) in the C block. There is no safe way to +ensure this, since C may be used unhygienically in destructors. The only +guarantee is that the C will be called if an exception is thrown. + +=item * + +The return value of the C block is not ignored, so if testing the result +of the expression for truth on success, be sure to return a false value from +the C block: + + my $obj = try { + MightFail->new; + } catch { + ... + + return; # avoid returning a true value; + }; + + return unless $obj; + +=item * + +C<$SIG{__DIE__}> is still in effect. + +Though it can be argued that C<$SIG{__DIE__}> should be disabled inside of +C blocks, since it isn't people have grown to rely on it. Therefore in +the interests of compatibility, C does not disable C<$SIG{__DIE__}> for +the scope of the error throwing code. + +=item * + +Lexical C<$_> may override the one set by C. + +For example Perl 5.10's C form uses a lexical C<$_>, creating some +confusing behavior: + + given ($foo) { + when (...) { + try { + ... + } catch { + warn $_; # will print $foo, not the error + warn $_[0]; # instead, get the error like this + } + } + } + +Note that this behavior was changed once again in +L. +However, since the entirety of lexical C<$_> is now L, it +is unclear whether the new version 18 behavior is final. + +=back + +=head1 SEE ALSO + +=over 4 + +=item L + +Only available on perls >= 5.14, with a slightly different syntax (e.g. no trailing C<;> because +it's actually a keyword, not a sub, but this means you can C and C within it). Use +L to automatically switch to the native C syntax in newer perls (when +available). See also L. + +=item L + +Much more feature complete, more convenient semantics, but at the cost of +implementation complexity. + +=item L + +Automatic error throwing for builtin functions and more. Also designed to +work well with C/C. + +=item L + +A lightweight role for rolling your own exception classes. + +=item L + +Exception object implementation with a C statement. Does not localize +C<$@>. + +=item L + +Provides a C statement, but properly calling C is your +responsibility. + +The C keyword pushes C<$@> onto an error stack, avoiding some of the +issues with C<$@>, but you still need to localize to prevent clobbering. + +=back + +=head1 LIGHTNING TALK + +I gave a lightning talk about this module, you can see the slides (Firefox +only): + +L + +Or read the source: + +L + +=head1 SUPPORT + +Bugs may be submitted through L +(or L). + +=head1 AUTHORS + +=over 4 + +=item * + +יובל קוג'מן (Yuval Kogman) + +=item * + +Jesse Luehrs + +=back + +=head1 CONTRIBUTORS + +=for stopwords Karen Etheridge Peter Rabbitson Ricardo Signes Mark Fowler Graham Knop Aristotle Pagaltzis Dagfinn Ilmari Mannsåker Lukas Mai Alex anaxagoras Andrew Yates awalker chromatic cm-perl David Lowe Glenn Hans Dieter Pearcey Jens Berthold Jonathan Yu Marc Mims Stosberg Pali Paul Howarth Rudolf Leermakers + +=over 4 + +=item * + +Karen Etheridge + +=item * + +Peter Rabbitson + +=item * + +Ricardo Signes + +=item * + +Mark Fowler + +=item * + +Graham Knop + +=item * + +Aristotle Pagaltzis + +=item * + +Dagfinn Ilmari Mannsåker + +=item * + +Lukas Mai + +=item * + +Alex + +=item * + +anaxagoras + +=item * + +Andrew Yates + +=item * + +awalker + +=item * + +chromatic + +=item * + +cm-perl + +=item * + +David Lowe + +=item * + +Glenn Fowler + +=item * + +Hans Dieter Pearcey + +=item * + +Jens Berthold + +=item * + +Jonathan Yu + +=item * + +Marc Mims + +=item * + +Mark Stosberg + +=item * + +Pali + +=item * + +Paul Howarth + +=item * + +Rudolf Leermakers + +=back + +=head1 COPYRIGHT AND LICENCE + +This software is Copyright (c) 2009 by יובל קוג'מן (Yuval Kogman). + +This is free software, licensed under: + + The MIT (X11) License + +=cut diff --git a/maint/bench.pl b/maint/bench.pl new file mode 100644 index 0000000..215097c --- /dev/null +++ b/maint/bench.pl @@ -0,0 +1,14 @@ +#!/usr/bin/env perl + +use warnings; +use strict; + +use Benchmark::Dumb ':all'; +use Try::Tiny; + +my $max = 10_000; + +cmpthese('0.003', { + eval => sub { do { local $@; eval { die 'foo' } } for (1..$max) }, + try => sub { do { try { die 'foo' } } for (1..$max) }, +}); diff --git a/t/00-report-prereqs.dd b/t/00-report-prereqs.dd new file mode 100644 index 0000000..5f907eb --- /dev/null +++ b/t/00-report-prereqs.dd @@ -0,0 +1,155 @@ +do { my $x = { + 'configure' => { + 'requires' => { + 'ExtUtils::MakeMaker' => '0', + 'perl' => '5.006' + }, + 'suggests' => { + 'JSON::PP' => '2.27300' + } + }, + 'develop' => { + 'recommends' => { + 'Dist::Zilla::PluginBundle::Author::ETHER' => '0.161', + 'Dist::Zilla::PluginBundle::Git::VersionManager' => '0.007' + }, + 'requires' => { + 'Capture::Tiny' => '0.12', + 'Encode' => '0', + 'File::Spec' => '0', + 'IO::Handle' => '0', + 'IPC::Open3' => '0', + 'Pod::Coverage::TrustPod' => '0', + 'Pod::Wordlist' => '0', + 'Sub::Name' => '0.08', + 'Sub::Util' => '0', + 'Test::CPAN::Changes' => '0.19', + 'Test::CPAN::Meta' => '0', + 'Test::EOL' => '0', + 'Test::Kwalitee' => '1.21', + 'Test::MinimumVersion' => '0', + 'Test::Mojibake' => '0', + 'Test::More' => '0.96', + 'Test::NoTabs' => '0', + 'Test::Pod' => '1.41', + 'Test::Pod::Coverage' => '1.08', + 'Test::Pod::No404s' => '0', + 'Test::Portability::Files' => '0', + 'Test::Spelling' => '0.12' + } + }, + 'runtime' => { + 'requires' => { + 'Carp' => '0', + 'Exporter' => '5.57', + 'constant' => '0', + 'perl' => '5.006', + 'strict' => '0', + 'warnings' => '0' + }, + 'suggests' => { + 'Sub::Name' => '0.08', + 'Sub::Util' => '0' + } + }, + 'test' => { + 'recommends' => { + 'CPAN::Meta' => '2.120900' + }, + 'requires' => { + 'ExtUtils::MakeMaker' => '0', + 'File::Spec' => '0', + 'Test::More' => '0', + 'if' => '0', + 'perl' => '5.006' + }, + 'suggests' => { + 'CPAN::Meta::Check' => '0.011', + 'CPAN::Meta::Requirements' => '0', + 'Capture::Tiny' => '0.12' + } + }, + 'x_Dist_Zilla' => { + 'requires' => { + 'Dist::Zilla' => '5', + 'Dist::Zilla::Plugin::Authority' => '1.009', + 'Dist::Zilla::Plugin::AutoMetaResources' => '0', + 'Dist::Zilla::Plugin::AutoPrereqs' => '5.038', + 'Dist::Zilla::Plugin::Breaks' => '0', + 'Dist::Zilla::Plugin::BumpVersionAfterRelease::Transitional' => '0.004', + 'Dist::Zilla::Plugin::CheckIssues' => '0', + 'Dist::Zilla::Plugin::CheckMetaResources' => '0', + 'Dist::Zilla::Plugin::CheckPrereqsIndexed' => '0.019', + 'Dist::Zilla::Plugin::CheckSelfDependency' => '0', + 'Dist::Zilla::Plugin::CheckStrictVersion' => '0', + 'Dist::Zilla::Plugin::ConfirmRelease' => '0', + 'Dist::Zilla::Plugin::CopyFilesFromRelease' => '0', + 'Dist::Zilla::Plugin::EnsureLatestPerl' => '0', + 'Dist::Zilla::Plugin::FileFinder::ByName' => '0', + 'Dist::Zilla::Plugin::FileFinder::Filter' => '0', + 'Dist::Zilla::Plugin::GenerateFile::FromShareDir' => '0', + 'Dist::Zilla::Plugin::Git::Check' => '0', + 'Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch' => '0.004', + 'Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts' => '0', + 'Dist::Zilla::Plugin::Git::Commit' => '2.020', + 'Dist::Zilla::Plugin::Git::Contributors' => '0.029', + 'Dist::Zilla::Plugin::Git::Describe' => '0.004', + 'Dist::Zilla::Plugin::Git::GatherDir' => '2.016', + 'Dist::Zilla::Plugin::Git::Push' => '0', + 'Dist::Zilla::Plugin::Git::Remote::Check' => '0', + 'Dist::Zilla::Plugin::Git::Tag' => '0', + 'Dist::Zilla::Plugin::GitHub::Update' => '0.40', + 'Dist::Zilla::Plugin::GithubMeta' => '0.54', + 'Dist::Zilla::Plugin::InstallGuide' => '1.200005', + 'Dist::Zilla::Plugin::Keywords' => '0.004', + 'Dist::Zilla::Plugin::License' => '5.038', + 'Dist::Zilla::Plugin::MakeMaker' => '0', + 'Dist::Zilla::Plugin::Manifest' => '0', + 'Dist::Zilla::Plugin::MetaConfig' => '0', + 'Dist::Zilla::Plugin::MetaJSON' => '0', + 'Dist::Zilla::Plugin::MetaNoIndex' => '0', + 'Dist::Zilla::Plugin::MetaProvides::Package' => '1.15000002', + 'Dist::Zilla::Plugin::MetaTests' => '0', + 'Dist::Zilla::Plugin::MetaYAML' => '0', + 'Dist::Zilla::Plugin::MinimumPerl' => '1.006', + 'Dist::Zilla::Plugin::MojibakeTests' => '0.8', + 'Dist::Zilla::Plugin::NextRelease' => '5.033', + 'Dist::Zilla::Plugin::OnlyCorePrereqs' => '0', + 'Dist::Zilla::Plugin::PodCoverageTests' => '5.040', + 'Dist::Zilla::Plugin::PodSyntaxTests' => '5.040', + 'Dist::Zilla::Plugin::PodWeaver' => '4.008', + 'Dist::Zilla::Plugin::Prereqs' => '0', + 'Dist::Zilla::Plugin::Prereqs::AuthorDeps' => '0.006', + 'Dist::Zilla::Plugin::Prereqs::Soften' => '0', + 'Dist::Zilla::Plugin::PromptIfStale' => '0', + 'Dist::Zilla::Plugin::Readme' => '0', + 'Dist::Zilla::Plugin::ReadmeAnyFromPod' => '0.142180', + 'Dist::Zilla::Plugin::RewriteVersion::Transitional' => '0.006', + 'Dist::Zilla::Plugin::Run::AfterBuild' => '0.041', + 'Dist::Zilla::Plugin::Run::AfterRelease' => '0.038', + 'Dist::Zilla::Plugin::RunExtraTests' => '0.024', + 'Dist::Zilla::Plugin::StaticInstall' => '0.005', + 'Dist::Zilla::Plugin::Substitute' => '0', + 'Dist::Zilla::Plugin::Test::CPAN::Changes' => '0.012', + 'Dist::Zilla::Plugin::Test::ChangesHasContent' => '0', + 'Dist::Zilla::Plugin::Test::CheckBreaks' => '0.018', + 'Dist::Zilla::Plugin::Test::Compile' => '2.039', + 'Dist::Zilla::Plugin::Test::EOL' => '0.17', + 'Dist::Zilla::Plugin::Test::Kwalitee' => '2.10', + 'Dist::Zilla::Plugin::Test::MinimumVersion' => '2.000010', + 'Dist::Zilla::Plugin::Test::NoTabs' => '0.08', + 'Dist::Zilla::Plugin::Test::Pod::No404s' => '1.003', + 'Dist::Zilla::Plugin::Test::PodSpelling' => '2.006003', + 'Dist::Zilla::Plugin::Test::Portability' => '2.000007', + 'Dist::Zilla::Plugin::Test::ReportPrereqs' => '0.022', + 'Dist::Zilla::Plugin::TestRelease' => '0', + 'Dist::Zilla::Plugin::UploadToCPAN' => '0', + 'Dist::Zilla::Plugin::UseUnsafeInc' => '0', + 'Dist::Zilla::PluginBundle::Author::ETHER' => '0.136', + 'Dist::Zilla::PluginBundle::Git::VersionManager' => '0.007', + 'Software::License::MIT' => '0' + } + } + }; + $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..2024f66 --- /dev/null +++ b/t/00-report-prereqs.t @@ -0,0 +1,200 @@ +#!perl + +use strict; +use warnings; + +# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.028 + +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( + Encode + File::Temp + JSON::PP + Module::Runtime + Pod::Coverage + Sub::Name + YAML + autodie +); + +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('Reported prereqs'); + +# vim: ts=4 sts=4 sw=4 et: diff --git a/t/basic.t b/t/basic.t new file mode 100644 index 0000000..43d5181 --- /dev/null +++ b/t/basic.t @@ -0,0 +1,163 @@ +use strict; +use warnings; + +use Test::More tests => 25; +use Try::Tiny; + +sub _eval { + local $@; + local $Test::Builder::Level = $Test::Builder::Level + 2; + return ( scalar(eval { $_[0]->(); 1 }), $@ ); +} + + +sub lives_ok (&$) { + my ( $code, $desc ) = @_; + local $Test::Builder::Level = $Test::Builder::Level + 1; + + my ( $ok, $error ) = _eval($code); + + ok($ok, $desc ); + + diag "error: $@" unless $ok; +} + +sub throws_ok (&$$) { + my ( $code, $regex, $desc ) = @_; + local $Test::Builder::Level = $Test::Builder::Level + 1; + + my ( $ok, $error ) = _eval($code); + + if ( $ok ) { + fail($desc); + } else { + like($error || '', $regex, $desc ); + } +} + + +my $prev; + +lives_ok { + try { + die "foo"; + }; +} "basic try"; + +throws_ok { + try { + die "foo"; + } catch { die $_ }; +} qr/foo/, "rethrow"; + + +{ + local $@ = "magic"; + is( try { 42 }, 42, "try block evaluated" ); + is( $@, "magic", '$@ untouched' ); +} + +{ + local $@ = "magic"; + is( try { die "foo" }, undef, "try block died" ); + is( $@, "magic", '$@ untouched' ); +} + +{ + local $@ = "magic"; + like( (try { die "foo" } catch { $_ }), qr/foo/, "catch block evaluated" ); + is( $@, "magic", '$@ untouched' ); +} + +is( scalar(try { "foo", "bar", "gorch" }), "gorch", "scalar context try" ); +is_deeply( [ try {qw(foo bar gorch)} ], [qw(foo bar gorch)], "list context try" ); + +is( scalar(try { die } catch { "foo", "bar", "gorch" }), "gorch", "scalar context catch" ); +is_deeply( [ try { die } catch {qw(foo bar gorch)} ], [qw(foo bar gorch)], "list context catch" ); + + +{ + my ($sub) = catch { my $a = $_; }; + is(ref($sub), 'Try::Tiny::Catch', 'Checking catch subroutine scalar reference is correctly blessed'); +} + +{ + my ($sub) = finally { my $a = $_; }; + is(ref($sub), 'Try::Tiny::Finally', 'Checking finally subroutine scalar reference is correctly blessed'); +} + +lives_ok { + try { + die "foo"; + } catch { + my $err = shift; + + try { + like $err, qr/foo/; + } catch { + fail("shouldn't happen"); + }; + + pass "got here"; + } +} "try in try catch block"; + +throws_ok { + try { + die "foo"; + } catch { + my $err = shift; + + try { } catch { }; + + die "rethrowing $err"; + } +} qr/rethrowing foo/, "rethrow with try in catch block"; + + +sub Evil::DESTROY { + eval { "oh noes" }; +} + +sub Evil::new { bless { }, $_[0] } + +{ + local $@ = "magic"; + local $_ = "other magic"; + + try { + my $object = Evil->new; + die "foo"; + } catch { + pass("catch invoked"); + local $TODO = "i don't think we can ever make this work sanely, maybe with SIG{__DIE__}" if "$]" < 5.014; + like($_, qr/foo/); + }; + + is( $@, "magic", '$@ untouched' ); + is( $_, "other magic", '$_ untouched' ); +} + +{ + my ( $caught, $prev ); + + { + local $@; + + eval { die "bar\n" }; + + is( $@, "bar\n", 'previous value of $@' ); + + try { + die { + prev => $@, + } + } catch { + $caught = $_; + $prev = $@; + } + } + + is_deeply( $caught, { prev => "bar\n" }, 'previous value of $@ available for capture' ); + is( $prev, "bar\n", 'previous value of $@ also available in catch block' ); +} diff --git a/t/context.t b/t/context.t new file mode 100644 index 0000000..226d6c4 --- /dev/null +++ b/t/context.t @@ -0,0 +1,62 @@ +use strict; +use warnings; + +use Test::More; +use Try::Tiny; + +plan tests => + (4+1) * 2 # list/scalar with exception (try + catch + 2 x finally) + is_deeply ++ 4 # void with exception ++ (3+1) * 2 # list/scalar no exception (try + 2 x finally) + is_deeply ++ 3 # void no exception +; + +my $ctx_index = { + VOID => undef, + LIST => 1, + SCALAR => '', +}; +my ($ctx, $die); + +for (sort keys %$ctx_index) { + $ctx = $_; + for (0,1) { + $die = $_; + if ($ctx_index->{$ctx}) { + is_deeply( + [ run() ], + [ $die ? 'catch' : 'try' ], + ); + } + elsif (defined $ctx_index->{$ctx}) { + is_deeply( + [ scalar run() ], + [ $die ? 'catch' : 'try' ], + ); + } + else { + run(); + 1; + } + } +} + +sub run { + try { + is (wantarray, $ctx_index->{$ctx}, "Proper context $ctx in try{}"); + die if $die; + return 'try'; + } + catch { + is (wantarray, $ctx_index->{$ctx}, "Proper context $ctx in catch{}"); + return 'catch'; + } + finally { + is (wantarray, undef, "Proper VOID context in finally{} 1"); + return 'finally'; + } + finally { + is (wantarray, undef, "Proper VOID context in finally{} 2"); + return 'finally'; + }; +} diff --git a/t/erroneous_usage.t b/t/erroneous_usage.t new file mode 100644 index 0000000..b6365ea --- /dev/null +++ b/t/erroneous_usage.t @@ -0,0 +1,74 @@ +use strict; +use warnings; + +use Test::More tests => 8; +use Try::Tiny; + +sub _eval { + local $@; + local $Test::Builder::Level = $Test::Builder::Level + 2; + return ( scalar(eval { $_[0]->(); 1 }), $@ ); +} + +sub throws_ok (&$$) { + my ( $code, $regex, $desc ) = @_; + local $Test::Builder::Level = $Test::Builder::Level + 1; + + my ( $ok, $error ) = _eval($code); + + if ( $ok ) { + fail($desc); + } else { + like($error || '', $regex, $desc ); + } +} + +throws_ok { + try { 1 }; catch { 2 }; +} qr/\QUseless bare catch()/, 'Bare catch() detected'; + +throws_ok { + try { 1 }; finally { 2 }; +} qr/\QUseless bare finally()/, 'Bare finally() detected'; + +throws_ok { + try { 1 }; catch { 2 } finally { 2 }; +} qr/\QUseless bare catch()/, 'Bare catch()/finally() detected'; + +throws_ok { + try { 1 }; finally { 2 } catch { 2 }; +} qr/\QUseless bare finally()/, 'Bare finally()/catch() detected'; + + +throws_ok { + try { 1 } catch { 2 } catch { 3 } finally { 4 } finally { 5 } +} qr/\QA try() may not be followed by multiple catch() blocks/, 'Multi-catch detected'; + + +throws_ok { + try { 1 } catch { 2 } + do { 2 } +} qr/\Qtry() encountered an unexpected argument (2) - perhaps a missing semi-colon before or at/, + 'Unterminated try detected'; + +sub foo { + try { 0 }; catch { 2 } +} + +throws_ok { + if (foo()) { + # ... + } +} qr/\QUseless bare catch/, + 'Bare catch at the end of a function call'; + +sub bar { + try { 0 }; finally { 2 } +} + +throws_ok { + if (bar()) { + # ... + } +} qr/\QUseless bare finally/, + 'Bare finally at the end of a function call'; diff --git a/t/finally.t b/t/finally.t new file mode 100644 index 0000000..00339bc --- /dev/null +++ b/t/finally.t @@ -0,0 +1,140 @@ +use strict; +use warnings; + +use Test::More tests => 30; +use Try::Tiny; + +try { + my $a = 1+1; +} catch { + fail('Cannot go into catch block because we did not throw an exception') +} finally { + pass('Moved into finally from try'); +}; + +try { + die('Die'); +} catch { + ok($_ =~ /Die/, 'Error text as expected'); + pass('Into catch block as we died in try'); +} finally { + pass('Moved into finally from catch'); +}; + +try { + die('Die'); +} finally { + pass('Moved into finally from catch'); +} catch { + ok($_ =~ /Die/, 'Error text as expected'); +}; + +try { + die('Die'); +} finally { + pass('Moved into finally block when try throws an exception and we have no catch block'); +}; + +try { + die('Die'); +} finally { + pass('First finally clause run'); +} finally { + pass('Second finally clause run'); +}; + +try { + # do not die +} finally { + if (@_) { + fail("errors reported: @_"); + } else { + pass("no error reported") ; + } +}; + +try { + die("Die\n"); +} finally { + is_deeply(\@_, [ "Die\n" ], "finally got passed the exception"); +}; + +try { + try { + die "foo"; + } + catch { + die "bar"; + } + finally { + pass("finally called"); + }; +}; + +$_ = "foo"; +try { + is($_, "foo", "not localized in try"); +} +catch { +} +finally { + is(scalar(@_), 0, "nothing in \@_ (finally)"); + is($_, "foo", "\$_ not localized (finally)"); +}; +is($_, "foo", "same afterwards"); + +$_ = "foo"; +try { + is($_, "foo", "not localized in try"); + die "bar\n"; +} +catch { + is($_[0], "bar\n", "error in \@_ (catch)"); + is($_, "bar\n", "error in \$_ (catch)"); +} +finally { + is(scalar(@_), 1, "error in \@_ (finally)"); + is($_[0], "bar\n", "error in \@_ (finally)"); + is($_, "foo", "\$_ not localized (finally)"); +}; +is($_, "foo", "same afterwards"); + +{ + my @warnings; + local $SIG{__WARN__} = sub { + $_[0] =~ /\QExecution of finally() block CODE(0x\E.+\Q) resulted in an exception/ + ? push @warnings, @_ + : warn @_ + }; + + try { + die 'tring' + } finally { + die 'fin 1' + } finally { + pass('fin 2 called') + } finally { + die 'fin 3' + }; + + is( scalar @warnings, 2, 'warnings from both fatal finally blocks' ); + + my @originals = sort map /Original exception text follows:\n\n(.+)/s, @warnings; + + like $originals[0], qr/fin 1 at/, 'First warning contains original exception'; + like $originals[1], qr/fin 3 at/, 'Second warning contains original exception'; +} + +{ + my $finally; + SKIP: { + try { + pass('before skip in try'); + skip 'whee', 1; + fail('not reached'); + } finally { + $finally = 1; + }; + } + ok $finally, 'finally ran'; +} diff --git a/t/given_when.t b/t/given_when.t new file mode 100644 index 0000000..d12fa9c --- /dev/null +++ b/t/given_when.t @@ -0,0 +1,38 @@ +use strict; +use warnings; + +use Test::More; + +BEGIN { + plan skip_all => 'Perl 5.010 is required' unless "$]" >= '5.010'; + plan skip_all => 'Tests skipped on perl 5.27.{7,8,9} when smartmatch behaviour changed' if "$]" >= '5.027007' and "$]" < '5.027010'; + plan tests => 2; +} + +use Try::Tiny; + +use 5.010; +no if "$]" >= 5.017011, warnings => 'experimental::smartmatch'; + +my ( $error, $topic ); + +given ("foo") { + when (qr/./) { + try { + die "blah\n"; + } catch { + $topic = $_; + $error = $_[0]; + } + }; +} + +is( $error, "blah\n", "error caught" ); + +{ + local $TODO = "perhaps a workaround can be found" + if "$]" < 5.017003; + is( $topic, $error, 'error is also in $_' ); +} + +# ex: set sw=4 et: diff --git a/t/global_destruction_forked.t b/t/global_destruction_forked.t new file mode 100644 index 0000000..b9855cc --- /dev/null +++ b/t/global_destruction_forked.t @@ -0,0 +1,58 @@ +use strict; +use warnings; + +use Test::More tests => 3; +use Try::Tiny; + +{ + package WithCatch; + use Try::Tiny; + + sub DESTROY { + try {} + catch {}; + return; + } +} + +{ + package WithFinally; + use Try::Tiny; + + our $_in_destroy; + sub DESTROY { + local $_in_destroy = 1; + try {} + finally {}; + return; + } +} + +try { + my $pid = fork; + unless ($pid) { + my $o = bless {}, 'WithCatch'; + $SIG{__DIE__} = sub { + exit 1 + if $_[0] =~ /A try\(\) may not be followed by multiple catch\(\) blocks/; + exit 2; + }; + exit 0; + } + waitpid $pid, 0; + is $?, 0, 'nested try in cleanup after fork does not maintain outer catch block'; +} +catch {}; + +try { + my $pid = fork; + unless ($pid) { + my $o = bless {}, 'WithFinally'; + exit 0; + } + waitpid $pid, 0; + is $?, 0, 'nested try in cleanup after fork does not maintain outer finally block'; +} +finally { exit 1 if $WithFinally::_in_destroy }; + +pass("Didn't just exit"); diff --git a/t/global_destruction_load.t b/t/global_destruction_load.t new file mode 100644 index 0000000..75c75cf --- /dev/null +++ b/t/global_destruction_load.t @@ -0,0 +1,19 @@ +use strict; +use warnings; + +use Test::More; + +BEGIN { + plan skip_all => 'Capture::Tiny 0.12 required' + unless eval { require Capture::Tiny; Capture::Tiny->VERSION(0.12); 1 }; + plan tests => 3; + Capture::Tiny->import(qw(capture_stderr)); +} + +for my $func (qw(try catch finally)) { + is capture_stderr { + system $^X, qw(-It/lib -we), + qq{sub DESTROY { require TryUser; TryUser->test_$func }} . + q{our $o; $o = bless []}; + }, '', "$func gets installed when loading Try::Tiny during global destruction"; +} diff --git a/t/lib/TryUser.pm b/t/lib/TryUser.pm new file mode 100644 index 0000000..c44d36b --- /dev/null +++ b/t/lib/TryUser.pm @@ -0,0 +1,9 @@ +package TryUser; + +use Try::Tiny; + +sub test_try { try { } } +sub test_catch { try { } catch { } } +sub test_finally { try { } finally { } } + +1; diff --git a/t/named.t b/t/named.t new file mode 100644 index 0000000..dfa6a97 --- /dev/null +++ b/t/named.t @@ -0,0 +1,35 @@ +use strict; +use warnings; + +use Test::More; + +BEGIN { + plan skip_all => "Sub::Util or Sub::Name required" + unless eval { require Sub::Util; defined &Sub::Util::set_subname; } + || eval { require Sub::Name; Sub::Name->VERSION(0.08) }; + plan tests => 3; +} + +use Try::Tiny; + +my $name; +try { + $name = (caller(0))[3]; +}; +is $name, "main::try {...} ", "try name"; # note extra space + +try { + die "Boom"; +} catch { + $name = (caller(0))[3]; +}; +is $name, "main::catch {...} ", "catch name"; # note extra space + +try { + die "Boom"; +} catch { + # noop +} finally { + $name = (caller(0))[3]; +}; +is $name, "main::finally {...} ", "finally name"; # note extra space diff --git a/t/when.t b/t/when.t new file mode 100644 index 0000000..1a45db1 --- /dev/null +++ b/t/when.t @@ -0,0 +1,36 @@ +use strict; +use warnings; + +use Test::More; + +BEGIN { + plan skip_all => 'Perl 5.010 is required' unless "$]" >= '5.010'; + plan skip_all => 'Tests skipped on perl 5.27.{7,8,9} when smartmatch behaviour changed' if "$]" >= '5.027007' and "$]" < '5.027010'; + plan tests => 5; +} + +use Try::Tiny; + +use 5.010; +no if "$]" >= 5.017011, warnings => 'experimental::smartmatch'; + +my ( $foo, $bar, $other ); + +$_ = "magic"; + +try { + die "foo"; +} catch { + + like( $_, qr/foo/ ); + + when (/bar/) { $bar++ }; + when (/foo/) { $foo++ }; + default { $other++ }; +}; + +is( $_, "magic", '$_ not clobbered' ); + +ok( !$bar, "bar didn't match" ); +ok( $foo, "foo matched" ); +ok( !$other, "fallback didn't match" ); diff --git a/t/zzz-check-breaks.t b/t/zzz-check-breaks.t new file mode 100644 index 0000000..6cfefb4 --- /dev/null +++ b/t/zzz-check-breaks.t @@ -0,0 +1,36 @@ +use strict; +use warnings; + +# this test was generated with Dist::Zilla::Plugin::Test::CheckBreaks 0.019 + +use Test::More tests => 2; + +SKIP: { + skip 'no conflicts module found to check against', 1; +} + +SKIP: { + # this data duplicates x_breaks in META.json + my $breaks = { + "Try::Tiny::Except" => "<= 0.01" + }; + + skip 'This information-only test requires CPAN::Meta::Requirements', 1 + if not eval { +require CPAN::Meta::Requirements }; + skip 'This information-only test requires CPAN::Meta::Check 0.011', 1 + if not eval { +require CPAN::Meta::Check; CPAN::Meta::Check->VERSION(0.011) }; + + my $reqs = CPAN::Meta::Requirements->new; + $reqs->add_string_requirement($_, $breaks->{$_}) foreach keys %$breaks; + + our $result = CPAN::Meta::Check::check_requirements($reqs, 'conflicts'); + + if (my @breaks = grep { defined $result->{$_} } keys %$result) + { + diag 'Breakages found with Try-Tiny:'; + diag "$result->{$_}" for sort @breaks; + diag "\n", 'You should now update these modules!'; + } + + pass 'checked x_breaks data'; +} diff --git a/xt/author/00-compile.t b/xt/author/00-compile.t new file mode 100644 index 0000000..3cf9adf --- /dev/null +++ b/xt/author/00-compile.t @@ -0,0 +1,60 @@ +use 5.006; +use strict; +use warnings; + +# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058 + +use Test::More 0.94; + +plan tests => 2; + +my @module_files = ( + 'Try/Tiny.pm' +); + + + +# no fake home requested + +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: ', explain(\@warnings); + +BAIL_OUT("Compilation problems") if !Test::More->builder->is_passing; diff --git a/xt/author/distmeta.t b/xt/author/distmeta.t new file mode 100644 index 0000000..c2280dc --- /dev/null +++ b/xt/author/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/author/eol.t b/xt/author/eol.t new file mode 100644 index 0000000..4bcf41d --- /dev/null +++ b/xt/author/eol.t @@ -0,0 +1,41 @@ +use strict; +use warnings; + +# this test was generated with Dist::Zilla::Plugin::Test::EOL 0.19 + +use Test::More 0.88; +use Test::EOL; + +my @files = ( + 'lib/Try/Tiny.pm', + 't/00-report-prereqs.dd', + 't/00-report-prereqs.t', + 't/basic.t', + 't/context.t', + 't/erroneous_usage.t', + 't/finally.t', + 't/given_when.t', + 't/global_destruction_forked.t', + 't/global_destruction_load.t', + 't/lib/TryUser.pm', + 't/named.t', + 't/when.t', + 't/zzz-check-breaks.t', + 'xt/author/00-compile.t', + 'xt/author/distmeta.t', + 'xt/author/eol.t', + 'xt/author/kwalitee.t', + 'xt/author/minimum-version.t', + 'xt/author/mojibake.t', + 'xt/author/no-tabs.t', + 'xt/author/pod-coverage.t', + 'xt/author/pod-no404s.t', + 'xt/author/pod-spell.t', + 'xt/author/pod-syntax.t', + 'xt/author/portability.t', + 'xt/release/changes_has_content.t', + 'xt/release/cpan-changes.t' +); + +eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files; +done_testing; diff --git a/xt/author/kwalitee.t b/xt/author/kwalitee.t new file mode 100644 index 0000000..c986546 --- /dev/null +++ b/xt/author/kwalitee.t @@ -0,0 +1,9 @@ +# this test was generated with Dist::Zilla::Plugin::Test::Kwalitee 2.12 +use strict; +use warnings; +use Test::More 0.88; +use Test::Kwalitee 1.21 'kwalitee_ok'; + +kwalitee_ok(); + +done_testing; diff --git a/xt/author/minimum-version.t b/xt/author/minimum-version.t new file mode 100644 index 0000000..e737dc7 --- /dev/null +++ b/xt/author/minimum-version.t @@ -0,0 +1,6 @@ +use strict; +use warnings; + +use Test::More; +use Test::MinimumVersion; +all_minimum_version_ok( qq{5.006} , { skip => [qw(t/given_when.t t/when.t)] }); diff --git a/xt/author/mojibake.t b/xt/author/mojibake.t new file mode 100644 index 0000000..5ef161e --- /dev/null +++ b/xt/author/mojibake.t @@ -0,0 +1,9 @@ +#!perl + +use strict; +use warnings qw(all); + +use Test::More; +use Test::Mojibake; + +all_files_encoding_ok(); diff --git a/xt/author/no-tabs.t b/xt/author/no-tabs.t new file mode 100644 index 0000000..c798874 --- /dev/null +++ b/xt/author/no-tabs.t @@ -0,0 +1,41 @@ +use strict; +use warnings; + +# this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.15 + +use Test::More 0.88; +use Test::NoTabs; + +my @files = ( + 'lib/Try/Tiny.pm', + 't/00-report-prereqs.dd', + 't/00-report-prereqs.t', + 't/basic.t', + 't/context.t', + 't/erroneous_usage.t', + 't/finally.t', + 't/given_when.t', + 't/global_destruction_forked.t', + 't/global_destruction_load.t', + 't/lib/TryUser.pm', + 't/named.t', + 't/when.t', + 't/zzz-check-breaks.t', + 'xt/author/00-compile.t', + 'xt/author/distmeta.t', + 'xt/author/eol.t', + 'xt/author/kwalitee.t', + 'xt/author/minimum-version.t', + 'xt/author/mojibake.t', + 'xt/author/no-tabs.t', + 'xt/author/pod-coverage.t', + 'xt/author/pod-no404s.t', + 'xt/author/pod-spell.t', + 'xt/author/pod-syntax.t', + 'xt/author/portability.t', + 'xt/release/changes_has_content.t', + 'xt/release/cpan-changes.t' +); + +notabs_ok($_) foreach @files; +done_testing; diff --git a/xt/author/pod-coverage.t b/xt/author/pod-coverage.t new file mode 100644 index 0000000..66b3b64 --- /dev/null +++ b/xt/author/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/author/pod-no404s.t b/xt/author/pod-no404s.t new file mode 100644 index 0000000..eb9760c --- /dev/null +++ b/xt/author/pod-no404s.t @@ -0,0 +1,21 @@ +#!perl + +use strict; +use warnings; +use Test::More; + +foreach my $env_skip ( qw( + SKIP_POD_NO404S + AUTOMATED_TESTING +) ){ + plan skip_all => "\$ENV{$env_skip} is set, skipping" + if $ENV{$env_skip}; +} + +eval "use Test::Pod::No404s"; +if ( $@ ) { + plan skip_all => 'Test::Pod::No404s required for testing POD'; +} +else { + all_pod_files_ok(); +} diff --git a/xt/author/pod-spell.t b/xt/author/pod-spell.t new file mode 100644 index 0000000..4c53a3b --- /dev/null +++ b/xt/author/pod-spell.t @@ -0,0 +1,86 @@ +use strict; +use warnings; +use Test::More; + +# generated by Dist::Zilla::Plugin::Test::PodSpelling 2.007005 +use Test::Spelling 0.12; +use Pod::Wordlist; + + +add_stopwords(); +all_pod_files_spelling_ok( qw( examples lib script t xt ) ); +__DATA__ +Alex +Andrew +Aristotle +Berthold +Dagfinn +David +Dieter +Etheridge +Fowler +Glenn +Graham +Hans +Howarth +Ilmari +JAWNSY +Jens +Jesse +Jonathan +Karen +Knop +Kogman +Leermakers +Lowe +Luehrs +Lukas +Mai +Mannsåker +Marc +Mark +Mims +Pagaltzis +Pali +Paul +Pearcey +Peter +Rabbitson +Ricardo +Rudolf +Signes +Stosberg +Tiny +Try +Yates +Yu +Yuval +alex +anaxagoras +awalker +ayates +cebjyre +chromatic +cm +davidl +doy +ether +haarg +hdp +ilmari +irc +jens +lib +mai +marc +mark +nothingmuch +pagaltzis +pali +paul +ribasushi +rjbs +rudolf +walkeraj +יובל +קוג diff --git a/xt/author/pod-syntax.t b/xt/author/pod-syntax.t new file mode 100644 index 0000000..e563e5d --- /dev/null +++ b/xt/author/pod-syntax.t @@ -0,0 +1,7 @@ +#!perl +# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. +use strict; use warnings; +use Test::More; +use Test::Pod 1.41; + +all_pod_files_ok(); diff --git a/xt/author/portability.t b/xt/author/portability.t new file mode 100644 index 0000000..c531252 --- /dev/null +++ b/xt/author/portability.t @@ -0,0 +1,10 @@ +use strict; +use warnings; + +use Test::More; + +eval 'use Test::Portability::Files'; +plan skip_all => 'Test::Portability::Files required for testing portability' + if $@; + +run_tests(); diff --git a/xt/release/changes_has_content.t b/xt/release/changes_has_content.t new file mode 100644 index 0000000..a4d43c4 --- /dev/null +++ b/xt/release/changes_has_content.t @@ -0,0 +1,42 @@ +use Test::More tests => 2; + +note 'Checking Changes'; +my $changes_file = 'Changes'; +my $newver = '0.31'; +my $trial_token = '-TRIAL'; +my $encoding = 'UTF-8'; + +SKIP: { + ok(-e $changes_file, "$changes_file file exists") + or skip 'Changes is missing', 1; + + ok(_get_changes($newver), "$changes_file has content for $newver"); +} + +done_testing; + +sub _get_changes +{ + my $newver = shift; + + # parse changelog to find commit message + open(my $fh, '<', $changes_file) or die "cannot open $changes_file: $!"; + my $changelog = join('', <$fh>); + if ($encoding) { + require Encode; + $changelog = Encode::decode($encoding, $changelog, Encode::FB_CROAK()); + } + close $fh; + + my @content = + grep { /^$newver(?:$trial_token)?(?:\s+|$)/ ... /^\S/ } # from newver to un-indented + split /\n/, $changelog; + shift @content; # drop the version line + + # drop unindented last line and trailing blank lines + pop @content while ( @content && $content[-1] =~ /^(?:\S|\s*$)/ ); + + # return number of non-blank lines + return scalar @content; +} + diff --git a/xt/release/cpan-changes.t b/xt/release/cpan-changes.t new file mode 100644 index 0000000..286005a --- /dev/null +++ b/xt/release/cpan-changes.t @@ -0,0 +1,10 @@ +use strict; +use warnings; + +# this test was generated with Dist::Zilla::Plugin::Test::CPAN::Changes 0.012 + +use Test::More 0.96 tests => 1; +use Test::CPAN::Changes; +subtest 'changes_ok' => sub { + changes_file_ok('Changes'); +}; -- 2.7.4 From a7888f954b333870813a87c964586e4528afa30c Mon Sep 17 00:00:00 2001 From: TizenOpenSource Date: Wed, 14 Feb 2024 16:11:30 +0900 Subject: [PATCH 3/4] Bump to 0.31 Signed-off-by: TizenOpenSource --- packaging/perl-Try-Tiny.manifest | 5 +++ packaging/perl-Try-Tiny.spec | 74 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 packaging/perl-Try-Tiny.manifest create mode 100644 packaging/perl-Try-Tiny.spec diff --git a/packaging/perl-Try-Tiny.manifest b/packaging/perl-Try-Tiny.manifest new file mode 100644 index 0000000..017d22d --- /dev/null +++ b/packaging/perl-Try-Tiny.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/perl-Try-Tiny.spec b/packaging/perl-Try-Tiny.spec new file mode 100644 index 0000000..56aa970 --- /dev/null +++ b/packaging/perl-Try-Tiny.spec @@ -0,0 +1,74 @@ +Name: perl-Try-Tiny +Version: 0.31 +Release: 1 +License: MIT +Summary: Minimal try/catch with proper preservation of $@ +Url: https://metacpan.org/pod/Try::Tiny +Group: Development/Libraries +Source0: %{name}-%{version}.tar.gz +Source1001: perl-Try-Tiny.manifest +BuildRequires: perl +BuildRequires: perl(MIME::Base64) +BuildArch: noarch + +%description +This module provides bare bones try/catch/finally statements that are +designed to minimize common mistakes with eval blocks, and NOTHING else. + +This is unlike TryCatch which provides a nice syntax and avoids adding +another call stack layer, and supports calling return from the try block +to return from the parent subroutine. These extra features come +at a cost of a few dependencies, namely Devel::Declare and Scope::Upper +which are occasionally problematic, and the additional catch filtering +uses Moose type constraints which may not be desirable either. + +The main focus of this module is to provide simple and reliable error +handling for those having a hard time installing TryCatch, but who still +want to write correct eval blocks without 5 lines of boilerplate each time. + +It's designed to work as correctly as possible in light of the various +pathological edge cases (see "BACKGROUND") and to be compatible with +any style of error values (simple strings, references, objects, overloaded +objects, etc). + +If the try block dies, it returns the value of the last statement executed +in the catch block, if there is one. Otherwise, it returns undef in scalar +context or the empty list in list context. The following examples +all assign "bar" to $x: + +my $x = try { die "foo" } catch { "bar" }; +my $x = try { die "foo" } || "bar"; +my $x = (try { die "foo" }) // "bar"; + + my $x = eval { die "foo" } || "bar"; + You can add finally blocks, yielding the following: + + my $x; + try { die 'foo' } finally { $x = 'bar' }; + try { die 'foo' } catch { warn "Got a die: $_" } finally { $x = 'bar' }; + + finally blocks are always executed making them suitable for cleanup code + which cannot be handled using local. You can add as many finally blocks + to a given try block as you like. + + Note that adding a finally block without a preceding catch block suppresses + any errors. This behaviour is consistent with using a standalone eval, + but it is not consistent with try/finally patterns found in other programming + languages, such as Java, Python, Javascript or C#. If you learned + the try/finally pattern from one of these languages, watch out for this. + +%prep +%setup -q -n %{name}-%{version} +cp %{SOURCE1001} . + +%build +perl Makefile.PL INSTALLDIRS=vendor +make %{?_smp_mflags} + +%install +%perl_make_install +%perl_process_packlist +%perl_gen_filelist + +%files -f %{name}.files +%license LICENCE -- 2.7.4 From 35ac9e4fb0a4a12a7092a1721373aafeace9487e Mon Sep 17 00:00:00 2001 From: TizenOpenSource Date: Thu, 29 Feb 2024 10:02:43 +0900 Subject: [PATCH 4/4] Remove noarch build option Change-Id: I924f1b4d608aa07373da39214e750c6dd935b910 Signed-off-by: TizenOpenSource --- packaging/perl-Try-Tiny.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/packaging/perl-Try-Tiny.spec b/packaging/perl-Try-Tiny.spec index 56aa970..3c55176 100644 --- a/packaging/perl-Try-Tiny.spec +++ b/packaging/perl-Try-Tiny.spec @@ -9,7 +9,6 @@ Source0: %{name}-%{version}.tar.gz Source1001: perl-Try-Tiny.manifest BuildRequires: perl BuildRequires: perl(MIME::Base64) -BuildArch: noarch %description This module provides bare bones try/catch/finally statements that are -- 2.7.4