-
-
04 Jan 2013 03:11:29 UTC
- Distribution: Try-Tiny-ByClass
- Module version: 0.01
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (1)
- Testers (10718 / 1 / 0)
- Kwalitee
Bus factor: 0- 100.00% Coverage
- License: perl_5
- Perl: v5.6.0
- Activity
24 month- Tools
- Download (3.43KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Dispatch::Class
- Exporter
- Try::Tiny
- base
- strict
- warnings
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Try::Tiny::ByClass - selectively catch exceptions by class name
SYNOPSIS
use Try::Tiny::ByClass; try { die $exception_object; } catch_case [ 'Some::Class' => sub { # handle Some::Class exceptions }, 'Exception::DivByZero' => sub { # handle Exception::DivByZero exceptions }, ], finally { # always do this };
DESCRIPTION
This module is a simple wrapper around
Try::Tiny
, which see. It re-exportstry
,catch
, andfinally
.In addition, it provides a way to catch only some exceptions by filtering on the class (including superclasses and consumed roles) of an exception object.
Functions
- catch_case ($;@)
-
Intended to be used instead of
catch
in the second argument position oftry
.Instead of a block it takes a reference to an array of
CLASS => CODEREF
pairs, which it passes on todispatch
inDispatch::Class
.
SEE ALSO
AUTHOR
Lukas Mai,
<l.mai at web.de>
COPYRIGHT & LICENSE
Copyright 2013 Lukas Mai.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
Module Install Instructions
To install Try::Tiny::ByClass, copy and paste the appropriate command in to your terminal.
cpanm Try::Tiny::ByClass
perl -MCPAN -e shell install Try::Tiny::ByClass
For more information on module installation, please visit the detailed CPAN module installation guide.