Error::Tiny - Tiny exceptions
use Error::Tiny; try { dangerous(); } catch MyCustomException then { my $e = shift; ...everything whose parent is MyCustomException... } catch { my $e = shift; ...everything else goes here... };
Error::Tiny is a lightweight exceptions implementation.
Objects everywhere
You will always get an object in the catch block. No need to check if it's a blessed reference or anything like that. And there is no need for $SIG{__DIE__}!
$SIG{__DIE__}
Exception class built-in
Error::Tiny::Exception is a lightweight base exception class. It is easy to throw an exception:
Error::Tiny::Exception->throw('error');
If you start getting strange behaviour when working with exceptions, make sure that you use Error::Tiny in the correct package in the correct place. Somehow perl doesn't report this as an error.
use
This will not work:
use Error::Tiny; package MyPackage; try { ... };
http://github.com/vti/error-tiny
Viacheslav Tykhanovskyi, vti@cpan.org.
vti@cpan.org
Copyright (C) 2013, Viacheslav Tykhanovskyi
This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.
To install Error::Tiny, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Error::Tiny
CPAN shell
perl -MCPAN -e shell install Error::Tiny
For more information on module installation, please visit the detailed CPAN module installation guide.