blib/lib/Try/Tiny/WarnCaught.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 16 | 16 | 100.0 |
branch | n/a | ||
condition | n/a | ||
subroutine | 6 | 6 | 100.0 |
pod | 0 | 1 | 0.0 |
total | 22 | 23 | 95.6 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Try::Tiny::WarnCaught; | ||||||
2 | our $VERSION = 0.01; | ||||||
3 | 1 | 1 | 403165 | use strictures; | |||
1 | 3 | ||||||
1 | 9 | ||||||
4 | 1 | 1 | 82 | use true; | |||
1 | 2 | ||||||
1 | 10 | ||||||
5 | 1 | 1 | 1021 | use Try::Tiny (); | |||
1 | 7 | ||||||
1 | 38 | ||||||
6 | 1 | 10 | use Sub::Exporter -setup => { | ||||
7 | exports => [qw(catch)], | ||||||
8 | groups => { | ||||||
9 | default => [ qw(catch) ], | ||||||
10 | }, | ||||||
11 | 1 | 1 | 14698 | }; | |||
1 | 11145 | ||||||
12 | |||||||
13 | sub catch (&;@) { | ||||||
14 | 1 | 1 | 0 | 102 | my $cb = shift; | ||
15 | Try::Tiny::catch { | ||||||
16 | 1 | 1 | 125 | warn "Caught exception: $_"; | |||
17 | 1 | 59 | $cb->(@_); | ||||
18 | 1 | 11 | }; | ||||
19 | } | ||||||
20 | |||||||
21 | __END__ |