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 Leap 15.2 |
Version: 0.30 | Vendor: openSUSE |
Release: lp152.3.2 | Build date: Fri Sep 20 18:18:05 2019 |
Group: Development/Libraries/Perl | Build host: lamb12 |
Size: 37451 | Source RPM: perl-Try-Tiny-0.30-lp152.3.2.src.rpm |
Packager: https://bugs.opensuse.org | |
Url: http://search.cpan.org/dist/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 learnt the 'try'/'finally' pattern from one of these languages, watch out for this.
MIT
* 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) * Fri Oct 04 2013 coolo@suse.com - updated to 0.18 - fix tests for pre-Test-More-0.88 (Paul Howarth, #10) - work around [rt.perl #119311] which was causing incorrect error messages in some cases during global destruction (Graham Knop, #9) * Sat Jul 27 2013 coolo@suse.com - updated to 0.16 - remove accidental Sub::Name test dep - optionally use Sub::Name to name the try/catch/finally blocks, if available (Mark Fowler) - also throw an exception for catch/finally in scalar context (RT#81070) - 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
/usr/lib/perl5/vendor_perl/5.26.1/Try /usr/lib/perl5/vendor_perl/5.26.1/Try/Tiny.pm /usr/lib/perl5/vendor_perl/5.26.1/x86_64-linux-thread-multi /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/LICENCE /usr/share/doc/packages/perl-Try-Tiny/README /usr/share/man/man3/Try::Tiny.3pm.gz
Generated by rpm2html 1.8.1
Fabrice Bellet, Thu May 9 11:29:15 2024