line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Try::Tiny::Except; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
242062
|
use 5.010000; |
|
10
|
|
|
|
|
34
|
|
|
10
|
|
|
|
|
501
|
|
4
|
10
|
|
|
10
|
|
69
|
use strict; |
|
10
|
|
|
|
|
18
|
|
|
10
|
|
|
|
|
415
|
|
5
|
10
|
|
|
10
|
|
44
|
use warnings; |
|
10
|
|
|
|
|
17
|
|
|
10
|
|
|
|
|
587
|
|
6
|
|
|
|
|
|
|
|
7
|
10
|
|
|
10
|
|
17525
|
use Try::Tiny qw/catch finally/; |
|
10
|
|
|
|
|
14753
|
|
|
10
|
|
|
|
|
892
|
|
8
|
10
|
50
|
|
10
|
|
600
|
BEGIN { eval "use Sub::Name; 1" or *{subname} = sub {1} } |
|
3
|
|
|
10
|
|
5
|
|
|
10
|
|
|
3
|
|
2430
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
9
|
|
|
|
|
|
|
my $try_orig; |
10
|
10
|
|
|
10
|
|
270
|
BEGIN { $try_orig = \&Try::Tiny::try }; |
11
|
|
|
|
|
|
|
|
12
|
10
|
|
|
10
|
|
63
|
use Exporter 5.57 'import'; |
|
10
|
|
|
|
|
214
|
|
|
10
|
|
|
|
|
3029
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @EXPORT = our @EXPORT_OK = qw/try catch finally/; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $always_propagate; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub try (&;@) { |
21
|
56
|
100
|
|
56
|
0
|
1150472
|
if ($always_propagate) { |
22
|
6
|
|
|
|
|
8
|
my $found; |
23
|
6
|
|
|
|
|
13
|
for my $code (@_) { |
24
|
11
|
100
|
|
|
|
33
|
if (ref($code) eq 'Try::Tiny::Catch') { |
25
|
3
|
|
|
|
|
5
|
$found=1; |
26
|
3
|
|
|
|
|
5
|
my $sub=$$code; |
27
|
3
|
|
|
|
|
6
|
my $caller = caller; |
28
|
3
|
|
|
|
|
11
|
subname("${caller}::catch {...} " => $sub); |
29
|
|
|
|
|
|
|
my $new=sub { |
30
|
3
|
100
|
|
3
|
|
116
|
die $_ if $always_propagate->(); |
31
|
1
|
|
|
|
|
9
|
goto &$sub; |
32
|
3
|
|
|
|
|
11
|
}; |
33
|
3
|
|
|
|
|
12
|
$code=bless \$new, 'Try::Tiny::Catch'; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
6
|
100
|
|
|
|
15
|
unless ($found) { |
37
|
|
|
|
|
|
|
my $new=sub { |
38
|
3
|
100
|
|
3
|
|
130
|
die $_ if $always_propagate->(); |
39
|
1
|
|
|
|
|
12
|
return; |
40
|
3
|
|
|
|
|
12
|
}; |
41
|
3
|
|
|
|
|
19
|
splice @_, 1, 0, bless (\$new, 'Try::Tiny::Catch'); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
56
|
|
|
|
|
302
|
goto &$try_orig; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
{ |
49
|
10
|
|
|
10
|
|
58
|
no warnings 'redefine'; |
|
10
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
812
|
|
50
|
|
|
|
|
|
|
*Try::Tiny::try = \&try; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
__END__ |