diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-08-18 15:08:00 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-08-18 16:25:59 -0500 |
commit | 93dd811c1233c3e9d28d92a56166436a81c3e854 (patch) | |
tree | 56710060e64212f37f85a651c5174c3523bd5bb1 /lib | |
parent | e590eb7516d6c3533254fb85699473e43ac9c8d8 (diff) | |
download | try-93dd811c1233c3e9d28d92a56166436a81c3e854.tar.gz try-93dd811c1233c3e9d28d92a56166436a81c3e854.zip |
first implementation
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Try.pm | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -0,0 +1,28 @@ +package Try; +use strict; +use warnings; +# ABSTRACT: nicer exception handling syntax + +use Devel::CallParser; +use XSLoader; + +XSLoader::load( + __PACKAGE__, + exists $Try::{VERSION} ? ${ $Try::{VERSION} } : (), +); + +use Exporter 'import'; +our @EXPORT = ('try'); + +use Try::Tiny (); + +sub try { + my ($try, $catch, $finally) = @_; + &Try::Tiny::try( + $try, + ($catch ? (&Try::Tiny::catch($catch)) : ()), + ($finally ? (&Try::Tiny::finally($finally)) : ()), + ); +} + +1; |