line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Promise::Tiny::AnyEvent; |
2
|
5
|
|
|
5
|
|
293370
|
use strict; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
195
|
|
3
|
5
|
|
|
5
|
|
28
|
use warnings; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
797
|
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
670
|
use parent 'Promise::Tiny'; |
|
5
|
|
|
|
|
249
|
|
|
5
|
|
|
|
|
31
|
|
6
|
5
|
|
|
5
|
|
5011
|
use AnyEvent; |
|
5
|
|
|
|
|
23694
|
|
|
5
|
|
|
|
|
240
|
|
7
|
5
|
|
|
5
|
|
36
|
use Exporter qw(import); |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
981
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @EXPORT_OK = qw(promise); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub promise { |
12
|
7
|
|
|
7
|
0
|
5081
|
return __PACKAGE__->new(@_); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub await { |
16
|
22
|
|
|
22
|
0
|
2596
|
my ($self) = @_; |
17
|
22
|
|
|
|
|
688
|
my $cv = AnyEvent->condvar; |
18
|
|
|
|
|
|
|
$self->then( |
19
|
|
|
|
|
|
|
sub { |
20
|
15
|
|
|
15
|
|
24
|
my ($value) = @_; |
21
|
15
|
|
|
|
|
74
|
$cv->send($value); |
22
|
|
|
|
|
|
|
}, |
23
|
|
|
|
|
|
|
sub { |
24
|
7
|
|
|
7
|
|
11
|
my ($reason) = @_; |
25
|
7
|
|
|
|
|
61
|
$cv->croak($reason); |
26
|
|
|
|
|
|
|
} |
27
|
22
|
|
|
|
|
9670
|
); |
28
|
22
|
|
|
|
|
106
|
return $cv->recv; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |