Skip to content

Instantly share code, notes, and snippets.

@sugar84
Created September 9, 2012 11:14
Show Gist options
  • Save sugar84/3683853 to your computer and use it in GitHub Desktop.
Save sugar84/3683853 to your computer and use it in GitHub Desktop.
Try::Tiny gotcha
#!/usr/bin/env perl
use Modern::Perl;
use Test::More;
use Test::Fatal qw/dies_ok/;
use Try::Tiny;
dies_ok { wrong_try_catch() } "First is dies";
dies_ok { wrong_try_catch2() } "Second should die too";
sub wrong_try_catch {
try {
"bla";
}
catch {
die "catch";
} ## <-- ';' is omitted
say 1;
return 1;
}
sub wrong_try_catch2 {
try {
"bla";
}
catch {
die "catch";
} ## <-- ';' is omitted
return 2;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment