line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::ACME2::PromiseUtil; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
104584
|
use strict; |
|
4
|
|
|
|
|
20
|
|
|
4
|
|
|
|
|
117
|
|
4
|
4
|
|
|
4
|
|
31
|
use warnings; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
754
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub then { |
7
|
194
|
|
|
194
|
0
|
6802
|
my ($maybe_promise, $todo_cr) = @_; |
8
|
|
|
|
|
|
|
|
9
|
194
|
100
|
|
|
|
998
|
if (UNIVERSAL::can($maybe_promise, 'then')) { |
10
|
1
|
|
|
|
|
5
|
return $maybe_promise->then($todo_cr); |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
193
|
|
|
|
|
546
|
return $todo_cr->($maybe_promise); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub do_then_catch { |
17
|
81
|
|
|
81
|
0
|
3847
|
my ($try_cr, $then_cr, $catch_cr) = @_; |
18
|
|
|
|
|
|
|
|
19
|
81
|
|
|
|
|
126
|
my $maybe_promise; |
20
|
|
|
|
|
|
|
|
21
|
81
|
|
|
|
|
161
|
my $old_err = $@; |
22
|
81
|
|
|
|
|
137
|
my $ok = eval { $maybe_promise = $try_cr->(); 1 }; |
|
81
|
|
|
|
|
186
|
|
|
80
|
|
|
|
|
222
|
|
23
|
81
|
|
|
|
|
167
|
my $err = $@; |
24
|
81
|
|
|
|
|
155
|
$@ = $old_err; |
25
|
|
|
|
|
|
|
|
26
|
81
|
100
|
|
|
|
207
|
if ($ok) { |
27
|
80
|
100
|
|
|
|
347
|
if (UNIVERSAL::can($maybe_promise, 'then')) { |
28
|
1
|
|
|
|
|
4
|
return $maybe_promise->then($then_cr, $catch_cr); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
else { |
31
|
79
|
|
|
|
|
325
|
return $then_cr->($maybe_promise); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
4
|
return $catch_cr->($err); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |