summaryrefslogtreecommitdiffstats
path: root/lib/Try.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Try.pm')
-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;