line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Promises6::Util; |
2
|
32
|
|
|
32
|
|
137
|
use Evo::Base -strict; |
|
32
|
|
|
|
|
45
|
|
|
32
|
|
|
|
|
179
|
|
3
|
|
|
|
|
|
|
|
4
|
32
|
|
|
32
|
|
3950
|
use Scalar::Util; |
|
32
|
|
|
|
|
51
|
|
|
32
|
|
|
|
|
2110
|
|
5
|
32
|
|
|
32
|
|
149
|
use Exporter 'import'; |
|
32
|
|
|
|
|
44
|
|
|
32
|
|
|
|
|
2742
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
my @CONST = qw(PENDING FULFILLED REJECTED PROGRESS); |
8
|
|
|
|
|
|
|
our @EXPORT_OK = (@CONST, qw(is_promise is_thenable)); |
9
|
|
|
|
|
|
|
our %EXPORT_TAGS = (all => \@EXPORT_OK, const => \@CONST); |
10
|
|
|
|
|
|
|
|
11
|
32
|
|
|
32
|
|
148
|
use constant PENDING => -1; |
|
32
|
|
|
|
|
42
|
|
|
32
|
|
|
|
|
2417
|
|
12
|
32
|
|
|
32
|
|
153
|
use constant FULFILLED => 0; |
|
32
|
|
|
|
|
43
|
|
|
32
|
|
|
|
|
1361
|
|
13
|
32
|
|
|
32
|
|
140
|
use constant REJECTED => 1; |
|
32
|
|
|
|
|
45
|
|
|
32
|
|
|
|
|
1547
|
|
14
|
32
|
|
|
32
|
|
146
|
use constant PROGRESS => 2; |
|
32
|
|
|
|
|
51
|
|
|
32
|
|
|
|
|
6187
|
|
15
|
|
|
|
|
|
|
|
16
|
256
|
50
|
|
256
|
1
|
564
|
sub is_promise($val) { |
|
256
|
50
|
|
|
|
507
|
|
|
256
|
|
|
|
|
264
|
|
|
256
|
|
|
|
|
224
|
|
17
|
256
|
100
|
100
|
|
|
1334
|
return unless $val && Scalar::Util::blessed($val); |
18
|
88
|
|
|
|
|
357
|
return $val->isa(Promises6::Builder->singleton->promise_class); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
207
|
50
|
|
207
|
1
|
426
|
sub is_thenable($val) { |
|
207
|
50
|
|
|
|
358
|
|
|
207
|
|
|
|
|
211
|
|
|
207
|
|
|
|
|
345
|
|
22
|
207
|
|
100
|
|
|
1544
|
return $val && Scalar::Util::blessed($val) && $val->can('then'); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# ABSTRACT: internal utils |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |