package Try::Tiny;
use strict;
-#use warnings;
+use warnings;
-use vars qw(@EXPORT @EXPORT_OK $VERSION @ISA);
+our $VERSION = "0.12";
+$VERSION = eval $VERSION if $VERSION =~ /_/;
-BEGIN {
- require Exporter;
- @ISA = qw(Exporter);
-}
-
-$VERSION = "0.12";
-
-$VERSION = eval $VERSION;
-
-@EXPORT = @EXPORT_OK = qw(try catch finally);
+use base 'Exporter';
+our @EXPORT = our @EXPORT_OK = qw(try catch finally);
+use Carp;
$Carp::Internal{+__PACKAGE__}++;
# Need to prototype as @ not $$ because of the way Perl evaluates the prototype.
} elsif ( $ref eq 'Try::Tiny::Finally' ) {
push @finally, ${$code_ref};
} else {
- use Carp;
confess("Unknown code ref type given '${ref}'. Check your usage & try again");
}
}
#!/usr/bin/perl
use strict;
-#use warnings;
+use warnings;
use Test::More;
BEGIN { use_ok 'Try::Tiny' }
use 5.010;
+no if $] >= 5.017011, warnings => 'experimental::smartmatch';
my ( $foo, $bar, $other );