blib/lib/RxPerl/IOAsync.pm

filter: Statementstmt 67.3% 35 / 52 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 64.2% 9 / 14 Podpod 0.0% 0 / 1 totaltotal 61.9% 44 / 71 SCAR 12.5
CC
3
Cov
62%
_cancel_timer
6.0
_cancel_interval
6.0
set_loop
2.0
CRAP 3.5
↑ Summary Build »
1 package RxPerl::IOAsync;
2 1 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use parent 'RxPerl::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use RxPerl ':all';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use IO::Async::Timer::Countdown;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use IO::Async::Timer::Periodic;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Sub::Util 'set_subname';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 our @EXPORT_OK = @RxPerl::EXPORT_OK;
16 1 our %EXPORT_TAGS = %RxPerl::EXPORT_TAGS;
17  
18 1 our $VERSION = "v6.8.0";
19  
20 1 our $promise_class = 'Future';
21  
22 1 foreach my $func_name (@EXPORT_OK) {
23 102 set_subname __PACKAGE__."::$func_name", \&{$func_name};
24 }
25  
26 1 our $loop;
27 0 ▶sub set_loop { $loop = $_[0] }
Subroutine set_loop: not called CC=1 SCAR=6.9
Pod undocumented
28  
29 sub _timer {
30 0 ▶ my ($after, $sub) = @_;
Subroutine _timer: not called CC=1 SCAR=6.9
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 ▶ my ($timer) = @_;
Subroutine _cancel_timer: not called CC=2 SCAR=17.9
46  
47 0 ▶ defined $timer or return;
Branch: 1 branch
BranchTrueFalseTotal
defined $timer or return 0 0 0
48  
49 0 $timer->remove_from_parent;
50 }
51  
52 sub _interval {
53 0 ▶ my ($after, $sub) = @_;
Subroutine _interval: not called CC=1 SCAR=6.9
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 ▶ my ($timer) = @_;
Subroutine _cancel_interval: not called CC=2 SCAR=17.9
69  
70 0 ▶ defined $timer or return;
Branch: 1 branch
BranchTrueFalseTotal
defined $timer or return 0 0 0
71  
72 0 $timer->remove_from_parent;
73 }
74  
75 1 1;
76 __END__
↑ Summary Build »