Index | index by Group | index by Distribution | index by Vendor | index by creation date | index by Name | Mirrors | Help | Search |
Name: perl-Try-Tiny | Distribution: openSUSE Tumbleweed |
Version: 0.320.0 | Vendor: openSUSE |
Release: 1.1 | Build date: Sat Aug 17 07:31:48 2024 |
Group: Unspecified | Build host: reproducible |
Size: 38581 | Source RPM: perl-Try-Tiny-0.320.0-1.1.src.rpm |
Packager: https://bugs.opensuse.org | |
Url: https://metacpan.org/release/Try-Tiny | |
Summary: Minimal try/catch with proper preservation of $@ |
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.
MIT
* Sat Aug 17 2024 Tina Müller <timueller+perl@suse.de> - updated to 0.320.0 (0.32) see /usr/share/doc/packages/perl-Try-Tiny/Changes 0.32 2024-08-16 22:23:44Z - skip given, when tests on perls >= 5.41.3 which removed these constructs * Wed Nov 24 2021 Tina Müller <timueller+perl@suse.de> - updated to 0.31 see /usr/share/doc/packages/perl-Try-Tiny/Changes 0.31 2021-11-23 20:29:12Z - plug Syntax::Keyword::Try and Feature::Compat::Try in the docs * Tue Jan 23 2018 coolo@suse.com - updated to 0.30 see /usr/share/doc/packages/perl-Try-Tiny/Changes 0.30 2017-12-21 07:23:03Z - expand "when" test skippage to more perl versions * Tue Dec 19 2017 coolo@suse.com - updated to 0.29 see /usr/share/doc/packages/perl-Try-Tiny/Changes 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) * Mon Jan 09 2017 coolo@suse.com - updated to 0.28 see /usr/share/doc/packages/perl-Try-Tiny/Changes 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) * Tue Aug 16 2016 coolo@suse.com - updated to 0.27 see /usr/share/doc/packages/perl-Try-Tiny/Changes 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) * Fri Dec 11 2015 coolo@suse.com - updated to 0.24 see /usr/share/doc/packages/perl-Try-Tiny/Changes 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, PR#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, PR#27) * Wed Jul 23 2014 mardnh@gmx.de - updated to 0.22 * Mon Apr 21 2014 mardnh@gmx.de - updated to 0.21 - 0.21 2014-04-15 - also skip the test if Capture::Tiny is too old (Martin Popel, #17) - 0.20 2014-03-21 - documentation updates (Flimm, #15) * Sun Feb 09 2014 coolo@suse.com - updated to 0.19 - fix an obscure issue with loading modules during global destruction (ilmari, #11) - documentation updates (anaxagoras, #12)
/usr/lib/perl5/vendor_perl/5.40.0/Try /usr/lib/perl5/vendor_perl/5.40.0/Try/Tiny.pm /usr/share/doc/packages/perl-Try-Tiny /usr/share/doc/packages/perl-Try-Tiny/CONTRIBUTING /usr/share/doc/packages/perl-Try-Tiny/Changes /usr/share/doc/packages/perl-Try-Tiny/README /usr/share/licenses/perl-Try-Tiny /usr/share/licenses/perl-Try-Tiny/LICENCE /usr/share/man/man3/Try::Tiny.3pm.gz
Generated by rpm2html 1.8.1
Fabrice Bellet, Wed Feb 12 23:53:52 2025