line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package RxPerl::IOAsync; |
2
|
1
|
|
|
1
|
|
267425
|
use 5.010; |
|
1
|
|
|
|
|
10
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use parent 'RxPerl::Base'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
74
|
use RxPerl ':all'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
298
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
582
|
use IO::Async::Timer::Countdown; |
|
1
|
|
|
|
|
17009
|
|
|
1
|
|
|
|
|
29
|
|
11
|
1
|
|
|
1
|
|
479
|
use IO::Async::Timer::Periodic; |
|
1
|
|
|
|
|
988
|
|
|
1
|
|
|
|
|
34
|
|
12
|
1
|
|
|
1
|
|
7
|
use Sub::Util 'set_subname'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
45
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
6
|
use Exporter 'import'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
361
|
|
15
|
|
|
|
|
|
|
our @EXPORT_OK = @RxPerl::EXPORT_OK; |
16
|
|
|
|
|
|
|
our %EXPORT_TAGS = %RxPerl::EXPORT_TAGS; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = "v6.9.0"; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $promise_class = 'Future'; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
foreach my $func_name (@EXPORT_OK) { |
23
|
|
|
|
|
|
|
set_subname __PACKAGE__."::$func_name", \&{$func_name}; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our $loop; |
27
|
0
|
|
|
0
|
0
|
|
sub set_loop { $loop = $_[0] } |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _timer { |
30
|
0
|
|
|
0
|
|
|
my ($after, $sub) = @_; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my $timer = IO::Async::Timer::Countdown->new( |
33
|
|
|
|
|
|
|
delay => $after, |
34
|
|
|
|
|
|
|
on_expire => $sub, |
35
|
|
|
|
|
|
|
remove_on_expire => 1, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
$timer->start; |
39
|
0
|
|
|
|
|
|
$loop->add($timer); |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
return $timer; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _cancel_timer { |
45
|
0
|
|
|
0
|
|
|
my ($timer) = @_; |
46
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
defined $timer or return; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
$timer->remove_from_parent; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _interval { |
53
|
0
|
|
|
0
|
|
|
my ($after, $sub) = @_; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $timer = IO::Async::Timer::Periodic->new( |
56
|
|
|
|
|
|
|
interval => $after, |
57
|
|
|
|
|
|
|
on_tick => $sub, |
58
|
|
|
|
|
|
|
reschedule => 'hard', |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
$timer->start; |
62
|
0
|
|
|
|
|
|
$loop->add($timer); |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
return $timer; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub _cancel_interval { |
68
|
0
|
|
|
0
|
|
|
my ($timer) = @_; |
69
|
|
|
|
|
|
|
|
70
|
0
|
0
|
|
|
|
|
defined $timer or return; |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
$timer->remove_from_parent; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
__END__ |