summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-08-18 15:08:00 -0500
committerJesse Luehrs <doy@tozt.net>2012-08-18 16:25:59 -0500
commit93dd811c1233c3e9d28d92a56166436a81c3e854 (patch)
tree56710060e64212f37f85a651c5174c3523bd5bb1 /lib
parente590eb7516d6c3533254fb85699473e43ac9c8d8 (diff)
downloadtry-93dd811c1233c3e9d28d92a56166436a81c3e854.tar.gz
try-93dd811c1233c3e9d28d92a56166436a81c3e854.zip
first implementation
Diffstat (limited to 'lib')
-rw-r--r--lib/Try.pm28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/Try.pm b/lib/Try.pm
index e69de29..d85d497 100644
--- a/lib/Try.pm
+++ b/lib/Try.pm
@@ -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;