blib/lib/Future/Q.pm

filter: Statementstmt 98.7% 162 / 164 Branchbran 86.7% 59 / 68 Conditioncond 78.6% 59 / 75 MC/DCmcdc 65.2% 30 / 46 Subroutinesub 100% 39 / 39 Podpod 100% 12 / 12 totaltotal 89.3% 361 / 404 CC 62 SCAR 14.5
CC
62
Cov
91%
DESTROY
8.4
__ANON__
7.0
then
7.0
CRAP 4.2
↑ Summary
1 package Future::Q;
2 20 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 20 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 20 ▶use Future 0.29;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 20 ▶use parent "Future";
Subroutine BEGIN: called CC=1 SCAR=0.0
6 20 ▶use Devel::GlobalDestruction;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 20 ▶use Scalar::Util qw(refaddr blessed weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 20 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 20 ▶use Try::Tiny ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 20 our $VERSION = '0.120';
12  
13 20 our @CARP_NOT = qw(Try::Tiny Future Future::PP Future::XS);
14  
15 20 our $OnError = undef;
16  
17 ## ** lexical attributes to avoid collision of names.
18  
19 20 my %failure_handled_for = ();
20  
21 1086 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
22 1086 my ($class, @args) = @_;
23 1086 my $self = $class->SUPER::new(@args);
24 1086 my $id = refaddr $self;
25 1086 $failure_handled_for{$id} = 0;
26 1086 return $self;
27 }
28  
29 1083 ▶sub _q_go_super_DESTROY {
Subroutine _q_go_super_DESTROY: called CC=2 SCAR=6.9
30 1083 my ($self) = @_;
31 1083 my $super_destroy = $self->can("SUPER::DESTROY");
32 1083 ▶ goto $super_destroy if defined $super_destroy;
Branch: 1 branch
BranchTrueFalseTotal
if defined $super_destroy 1 1082 1083
33 }
34  
35 1083 ▶sub DESTROY {
Subroutine DESTROY: called CC=8 SCAR=21.2
36 1083 my ($self) = @_;
37 1083 ▶ if(in_global_destruction) {
Branch: 1 branch
BranchTrueFalseTotal
if (&in_global_destruction()) 0 1083 1083
38 0 goto \&_q_go_super_DESTROY;
39 }
40 1083 my $id = refaddr $self;
41 1083 ▶ if($self->is_ready && $self->failure && !$failure_handled_for{$id}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_ready and $self->failure and not $failure_handled_for{$id}) 104 979 1083
Condition100%6/6
$self->is_ready and $self->failure and not $failure_handled_for{$id}
!ll&&!rl&&r
757222104
$self->is_ready and $self->failure
!ll&&!rl&&r
54703326
MC/DC100%3/3
$self->is_ready and $self->failure and not $failure_handled_for{$id}
$self->is_ready $self->failure not $failure_handled_for{$id}
Truth table100%4/4
A and B and not(C)
A= $self->is_readyB= $self->failureC= not $failure_handled_for{$id}
ABCresult
0XX0
10X0
1100
1111
42 104 $self->_q_warn_failure();
43 104 ▶ my @failed_subfutures = Try::Tiny::try {
Subroutine __ANON__: called CC=1 SCAR=0.0
44 104 $self->failed_futures;
45 98 ▶ }Try::Tiny::catch {
Subroutine __ANON__: called CC=1 SCAR=0.0
46 98 ();
47 104 };
48 104 foreach my $f (@failed_subfutures) {
49 16 ▶ $f->_q_warn_failure(is_subfuture => 1) if blessed($f) && $f->can('_q_warn_failure');
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($f) and $f->can("_q_warn_failure") 16 0 16
Condition33%1/3
builtin::blessed($f) and $f->can("_q_warn_failure")
!ll&&!rl&&r
0016
MC/DC0%0/2
builtin::blessed($f) and $f->can("_q_warn_failure")
builtin::blessed($f) $f->can("_q_warn_failure")
Truth table33%1/3
A and B
A= builtin::blessed($f)B= $f->can("_q_warn_failure")
ABresult
0X0
100
111
50 }
51 }
52 1083 delete $failure_handled_for{$id};
53 1083 goto \&_q_go_super_DESTROY;
54 }
55  
56 576 ▶sub _q_set_failure_handled {
Subroutine _q_set_failure_handled: called CC=1 SCAR=0.0
57 576 my ($self) = @_;
58 576 $failure_handled_for{refaddr $self} = 1;
59 }
60  
61 120 ▶sub _q_warn_failure {
Subroutine _q_warn_failure: called CC=6 SCAR=18.5
62 120 my ($self, %options) = @_;
63 120 ▶ if($self->is_ready && $self->failure) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_ready and $self->failure) 120 0 120
Condition33%1/3
$self->is_ready and $self->failure
!ll&&!rl&&r
00120
MC/DC0%0/2
$self->is_ready and $self->failure
$self->is_ready $self->failure
Truth table33%1/3
A and B
A= $self->is_readyB= $self->failure
ABresult
0X0
100
111
64 120 my $failure = $self->failure;
65 my $message = Carp::shortmess($options{is_subfuture}
66 120 ▶ ? "Failure of subfuture $self may not be handled: $failure subfuture may be lost"
Branch: 1 branch
BranchTrueFalseTotal
$options{'is_subfuture'} ? : 16 104 120
67 : "Failure of $self is not handled: $failure future is lost");
68 120 ▶ if(defined($OnError) && ref($OnError) eq "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $Future::Q::OnError and ref $Future::Q::OnError eq 'CODE') { } 117 3 120
Condition66%2/3
defined $Future::Q::OnError and ref $Future::Q::OnError eq "CODE"
!ll&&!rl&&r
30117
MC/DC50%1/2
defined $Future::Q::OnError and ref $Future::Q::OnError eq "CODE"
defined $Future::Q::OnError ref $Future::Q::OnError eq "CODE"
Truth table66%2/3
A and B
A= defined $Future::Q::OnErrorB= ref $Future::Q::OnError eq "CODE"
ABresult
0X0
100
111
69 117 $OnError->($message);
70 }else {
71 3 warn $message;
72 }
73 }
74 }
75  
76 193 ▶sub try {
Subroutine try: called CC=3 SCAR=11.0
Pod documented
77 193 my ($class, $func, @args) = @_;
78 193 ▶ if(!defined($func) || ref($func) ne "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $func or ref $func ne "CODE") 7 186 193
Condition100%3/3
not defined $func or ref $func ne "CODE"
l!l&&r!l&&!r
16186
MC/DC100%2/2
not defined $func or ref $func ne "CODE"
not defined $func ref $func ne "CODE"
Truth table100%3/3
not(A) or B
A= not defined $funcB= ref $func ne "CODE"
ABresult
1X1
011
000
79 7 ▶ $func = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
80 7 croak("func parameter for try() must be a code-ref");
81 7 };
82 }
83 193 ▶ my $result_future = Try::Tiny::try {
Subroutine __ANON__: called CC=4 SCAR=13.9
84 193 my @results = $func->(@args);
85 163 ▶ if(scalar(@results) == 1 && blessed($results[0]) && $results[0]->isa('Future')) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @results == 1 and builtin::blessed($results[0]) and $results[0]->isa('Future')) { } 96 67 163
Condition83%5/6
scalar @results == 1 and builtin::blessed($results[0]) and $results[0]->isa("Future")
!ll&&!rl&&r
67096
scalar @results == 1 and builtin::blessed($results[0])
!ll&&!rl&&r
254296
MC/DC66%2/3
scalar @results == 1 and builtin::blessed($results[0]) and $results[0]->isa("Future")
scalar @results == 1 builtin::blessed($results[0]) $results[0]->isa("Future")
Truth table75%3/4
A and B and C
A= scalar @results == 1B= builtin::blessed($results[0])C= $results[0]->isa("Future")
ABCresult
0XX0
10X0
1100
1111
86 96 return $results[0];
87 }else {
88 67 return $class->new->fulfill(@results);
89 }
90 30 ▶ } Try::Tiny::catch {
Subroutine __ANON__: called CC=1 SCAR=0.0
91 30 my $e = shift;
92 30 return $class->new->reject($e);
93 193 };
94 193 return $result_future;
95 }
96  
97 2 ▶sub fcall {
Subroutine fcall: called CC=1 SCAR=0.0
Pod documented
98 2 goto $_[0]->can('try');
99 }
100  
101 327 ▶sub then {
Subroutine then: called CC=7 SCAR=19.5
Pod documented
102 327 my ($self, $on_fulfilled, $on_rejected) = @_;
103 327 ▶ if(defined($on_fulfilled) && ref($on_fulfilled) ne "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $on_fulfilled and ref $on_fulfilled ne "CODE") 4 323 327
Condition100%3/3
defined $on_fulfilled and ref $on_fulfilled ne "CODE"
!ll&&!rl&&r
1961274
MC/DC100%2/2
defined $on_fulfilled and ref $on_fulfilled ne "CODE"
defined $on_fulfilled ref $on_fulfilled ne "CODE"
Truth table100%3/3
A and B
A= defined $on_fulfilledB= ref $on_fulfilled ne "CODE"
ABresult
0X0
100
111
104 4 $on_fulfilled = undef;
105 }
106 327 ▶ if(defined($on_rejected) && ref($on_rejected) ne "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $on_rejected and ref $on_rejected ne "CODE") 1 326 327
Condition100%3/3
defined $on_rejected and ref $on_rejected ne "CODE"
!ll&&!rl&&r
1681581
MC/DC100%2/2
defined $on_rejected and ref $on_rejected ne "CODE"
defined $on_rejected ref $on_rejected ne "CODE"
Truth table100%3/3
A and B
A= defined $on_rejectedB= ref $on_rejected ne "CODE"
ABresult
0X0
100
111
107 1 $on_rejected = undef;
108 }
109 327 my $class = ref($self);
110 327 $self->_q_set_failure_handled();
111
112 327 my $next_future = $self->new;
113 319 ▶ $self->on_ready(sub {
Subroutine __ANON__: called CC=7 SCAR=19.5
114 319 my $invo_future = shift;
115 319 ▶ if($invo_future->is_cancelled) {
Branch: 1 branch
BranchTrueFalseTotal
if ($invo_future->is_cancelled) 98 221 319
116 98 ▶ $next_future->cancel() if $next_future->is_pending;
Branch: 1 branch
BranchTrueFalseTotal
if $next_future->is_pending 98 0 98
117 98 return;
118 }
119 221 my $return_future = $invo_future;
120 221 ▶ if($invo_future->is_rejected && defined($on_rejected)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($invo_future->is_rejected and defined $on_rejected) { } 79 142 221
elsif ($invo_future->is_fulfilled and defined $on_fulfilled) { } 54 126 180
Condition100%3/3
$invo_future->is_rejected and defined $on_rejected
!ll&&!rl&&r
1043879
MC/DC100%2/2
$invo_future->is_rejected and defined $on_rejected
$invo_future->is_rejected defined $on_rejected
Truth table100%3/3
A and B
A= $invo_future->is_rejectedB= defined $on_rejected
ABresult
0X0
100
111
121 79 $return_future = $class->try($on_rejected, $invo_future->failure);
122 ▶ }elsif($invo_future->is_fulfilled && defined($on_fulfilled)) {
Condition100%3/3
$invo_future->is_fulfilled and defined $on_fulfilled
!ll&&!rl&&r
385054
MC/DC100%2/2
$invo_future->is_fulfilled and defined $on_fulfilled
$invo_future->is_fulfilled defined $on_fulfilled
Truth table100%3/3
A and B
A= $invo_future->is_fulfilledB= defined $on_fulfilled
ABresult
0X0
100
111
123 54 $return_future = $class->try($on_fulfilled, $invo_future->get);
124 }
125 221 $next_future->resolve($return_future);
126 327 });
127 327 ▶ if($next_future->is_pending && $self->is_pending) {
Branch: 1 branch
BranchTrueFalseTotal
if ($next_future->is_pending and $self->is_pending) 178 149 327
Condition100%3/3
$next_future->is_pending and $self->is_pending
!ll&&!rl&&r
13316178
MC/DC100%2/2
$next_future->is_pending and $self->is_pending
$next_future->is_pending $self->is_pending
Truth table100%3/3
A and B
A= $next_future->is_pendingB= $self->is_pending
ABresult
0X0
100
111
128 178 weaken(my $invo_future = $self);
129 79 ▶ $next_future->on_cancel(sub {
Subroutine __ANON__: called CC=3 SCAR=11.1
130 79 ▶ if(defined($invo_future) && $invo_future->is_pending) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $invo_future and $invo_future->is_pending) 12 67 79
Condition66%2/3
defined $invo_future and $invo_future->is_pending
!ll&&!rl&&r
06712
MC/DC50%1/2
defined $invo_future and $invo_future->is_pending
defined $invo_future $invo_future->is_pending
Truth table66%2/3
A and B
A= defined $invo_futureB= $invo_future->is_pending
ABresult
0X0
100
111
131 12 $invo_future->cancel();
132 }
133 178 });
134 }
135 327 return $next_future;
136 }
137  
138 51 ▶sub catch {
Subroutine catch: called CC=1 SCAR=0.0
Pod documented
139 51 my ($self, $on_rejected) = @_;
140 51 @_ = ($self, undef, $on_rejected);
141 51 goto $self->can('then');
142 }
143  
144 353 ▶sub fulfill {
Subroutine fulfill: called CC=1 SCAR=0.0
Pod documented
145 353 goto $_[0]->can('done');
146 }
147  
148 314 ▶sub resolve {
Subroutine resolve: called CC=6 SCAR=17.9
Pod documented
149 314 my ($self, @result) = @_;
150 314 ▶ if(not (@result == 1 && blessed($result[0]) && $result[0]->isa("Future"))) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@result == 1 and builtin::blessed($result[0]) and $result[0]->isa("Future")) 7 307 314
Condition83%5/6
@result == 1 and builtin::blessed($result[0]) and $result[0]->isa("Future")
!ll&&!rl&&r
70307
@result == 1 and builtin::blessed($result[0])
!ll&&!rl&&r
34307
MC/DC66%2/3
@result == 1 and builtin::blessed($result[0]) and $result[0]->isa("Future")
@result == 1 builtin::blessed($result[0]) $result[0]->isa("Future")
Truth table75%3/4
A and B and C
A= @result == 1B= builtin::blessed($result[0])C= $result[0]->isa("Future")
ABCresult
0XX0
10X0
1100
1111
151 7 goto $self->can("fulfill");
152 }
153 307 ▶ return $self if $self->is_cancelled;
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_cancelled 7 300 307
154 300 my $base_future = $result[0];
155  
156 ## Maybe we should check if $base_future is identical to
157 ## $self. Promises/A+ spec v1.1 [1] states we should reject $self
158 ## in that case. However, since Q v1.0.1 does not care that case,
159 ## we also leave that case unchecked for now.
160 ##
161 ## [1]: https://github.com/promises-aplus/promises-spec/tree/1.1.0
162
163 297 ▶ $base_future->on_ready(sub {
Subroutine __ANON__: called CC=5 SCAR=16.1
164 297 my $base_future = shift;
165 297 ▶ return if $self->is_ready;
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_ready 0 297 297
166 297 ▶ if($base_future->is_cancelled) {
Branch: 2 branches
BranchTrueFalseTotal
if ($base_future->is_cancelled) { } 53 244 297
elsif ($base_future->failure) { } 102 142 244
167 53 $self->cancel();
168 }elsif($base_future->failure) {
169 102 ▶ if($base_future->can("_q_set_failure_handled")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($base_future->can("_q_set_failure_handled")) 97 5 102
170 97 $base_future->_q_set_failure_handled();
171 }
172 102 $self->reject($base_future->failure);
173 }else {
174 142 $self->fulfill($base_future->get);
175 }
176 300 });
177 300 ▶ if(!$base_future->is_ready) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($base_future->is_ready) 76 224 300
178 76 weaken(my $weak_base = $base_future);
179 43 ▶ $self->on_cancel(sub {
Subroutine __ANON__: called CC=3 SCAR=11.1
180 43 ▶ $weak_base->cancel() if defined($weak_base) && !$weak_base->is_ready;
Branch: 1 branch
BranchTrueFalseTotal
if defined $weak_base and not $weak_base->is_ready 14 29 43
Condition66%2/3
defined $weak_base and not $weak_base->is_ready
!ll&&!rl&&r
02914
MC/DC50%1/2
defined $weak_base and not $weak_base->is_ready
defined $weak_base not $weak_base->is_ready
Truth table66%2/3
A and not(B)
A= defined $weak_baseB= not $weak_base->is_ready
ABresult
0X0
100
111
181 76 });
182 }
183 300 return $self;
184 }
185  
186 257 ▶sub reject {
Subroutine reject: called CC=1 SCAR=0.0
Pod documented
187 257 goto $_[0]->can('fail');
188 }
189  
190 1431 ▶sub is_pending {
Subroutine is_pending: called CC=1 SCAR=0.0
Pod documented
191 1431 my ($self) = @_;
192 1431 return !$self->is_ready;
193 }
194  
195 281 ▶sub is_fulfilled {
Subroutine is_fulfilled: called CC=3 SCAR=11.0
Pod documented
196 281 my ($self) = @_;
197 281 ▶ return (!$self->is_pending && !$self->is_cancelled && !$self->is_rejected);
Condition100%6/6
$self->is_pending || $self->is_cancelled || $self->is_rejected
l!l&&r!l&&!r
239240
$self->is_pending or $self->is_cancelled
l!l&&r!l&&!r
11279
MC/DC100%3/3
$self->is_pending || $self->is_cancelled || $self->is_rejected
$self->is_pending $self->is_cancelled $self->is_rejected
Truth table100%4/4
A or B || C
A= $self->is_pendingB= $self->is_cancelledC= $self->is_rejected
ABCresult
1XX1
01X1
0011
0000
198 }
199  
200 643 ▶sub is_rejected {
Subroutine is_rejected: called CC=2 SCAR=6.9
Pod documented
201 643 my ($self) = @_;
202 643 ▶ return ($self->is_ready && !!$self->failure);
Condition100%3/3
$self->is_ready && !!$self->failure
!ll&&!rl&&r
1346296
MC/DC100%2/2
$self->is_ready && !!$self->failure
$self->is_ready !!$self->failure
Truth table100%3/3
A && B
A= $self->is_readyB= !!$self->failure
ABresult
0X0
100
111
203 }
204  
205 20 foreach my $method (qw(wait_all wait_any needs_all needs_any)) {
206 20 ▶ no strict "refs";
Subroutine BEGIN: called CC=1 SCAR=0.0
207 80 my $supermethod_code = __PACKAGE__->can("SUPER::$method");
208 80 ▶ *{$method} = sub {
Subroutine __ANON__: called CC=4 SCAR=14.6
209 22 my ($self, @subfutures) = @_;
210 22 foreach my $sub (@subfutures) {
211 99 ▶ next if !blessed($sub) || !$sub->can('_q_set_failure_handled');
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($sub) and $sub->can("_q_set_failure_handled") 0 99 99
Condition33%1/3
builtin::blessed($sub) and $sub->can("_q_set_failure_handled")
!ll&&!rl&&r
0099
MC/DC0%0/2
builtin::blessed($sub) and $sub->can("_q_set_failure_handled")
builtin::blessed($sub) $sub->can("_q_set_failure_handled")
Truth table33%1/3
A and B
A= builtin::blessed($sub)B= $sub->can("_q_set_failure_handled")
ABresult
0X0
100
111
212 99 $sub->_q_set_failure_handled();
213 }
214 22 goto $supermethod_code;
215 80 };
216 }
217  
218 53 ▶sub finally {
Subroutine finally: called CC=4 SCAR=14.0
Pod documented
219 53 my ($self, $callback) = @_;
220 53 my $class = ref($self);
221 53 $self->_q_set_failure_handled();
222 53 ▶ if(!defined($callback) || ref($callback) ne "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $callback or ref $callback ne "CODE") 0 53 53
Condition33%1/3
not defined $callback or ref $callback ne "CODE"
l!l&&r!l&&!r
0053
MC/DC0%0/2
not defined $callback or ref $callback ne "CODE"
not defined $callback ref $callback ne "CODE"
Truth table33%1/3
not(A) or B
A= not defined $callbackB= ref $callback ne "CODE"
ABresult
1X1
011
000
223 0 return $class->new->reject("Callback for finally() must be a code-ref");
224 }
225 53 my $next_future = $self->new;
226 53 ▶ $self->on_ready(sub {
Subroutine __ANON__: called CC=4 SCAR=14.0
227 53 my ($invo_future) = @_;
228 53 ▶ if($invo_future->is_cancelled) {
Branch: 1 branch
BranchTrueFalseTotal
if ($invo_future->is_cancelled) 17 36 53
229 17 ▶ $next_future->cancel if $next_future->is_pending;
Branch: 1 branch
BranchTrueFalseTotal
if $next_future->is_pending 17 0 17
230 17 return;
231 }
232 36 my $returned_future = $class->try($callback);
233 36 ▶ $returned_future->on_ready(sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
234 36 my ($returned_future) = @_;
235 36 ▶ if(!$returned_future->is_cancelled && $returned_future->failure) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $returned_future->is_cancelled and $returned_future->failure) { } 13 23 36
Condition100%3/3
not $returned_future->is_cancelled and $returned_future->failure
!ll&&!rl&&r
101313
MC/DC100%2/2
not $returned_future->is_cancelled and $returned_future->failure
not $returned_future->is_cancelled $returned_future->failure
Truth table100%3/3
not(A) and B
A= not $returned_future->is_cancelledB= $returned_future->failure
ABresult
0X0
100
111
236 13 $next_future->resolve($returned_future);
237 }else {
238 23 $next_future->resolve($invo_future);
239 }
240 36 });
241 36 ▶ if(!$returned_future->is_ready) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $returned_future->is_ready) 16 20 36
242 16 weaken(my $weak_returned = $returned_future);
243 2 ▶ $next_future->on_cancel(sub {
Subroutine __ANON__: called CC=3 SCAR=14.2
244 2 ▶ $weak_returned->cancel if defined($weak_returned) && !$weak_returned->is_ready;
Branch: 1 branch
BranchTrueFalseTotal
if defined $weak_returned and not $weak_returned->is_ready 2 0 2
Condition33%1/3
defined $weak_returned and not $weak_returned->is_ready
!ll&&!rl&&r
002
MC/DC0%0/2
defined $weak_returned and not $weak_returned->is_ready
defined $weak_returned not $weak_returned->is_ready
Truth table33%1/3
A and not(B)
A= defined $weak_returnedB= not $weak_returned->is_ready
ABresult
0X0
100
111
245 16 });
246 }
247 53 });
248 53 ▶ if(!$self->is_ready) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->is_ready) 27 26 53
249 27 weaken(my $weak_invo = $self);
250 9 ▶ $next_future->on_cancel(sub {
Subroutine __ANON__: called CC=3 SCAR=11.1
251 9 ▶ $weak_invo->cancel if defined($weak_invo) && !$weak_invo->is_ready;
Branch: 1 branch
BranchTrueFalseTotal
if defined $weak_invo and not $weak_invo->is_ready 1 8 9
Condition66%2/3
defined $weak_invo and not $weak_invo->is_ready
!ll&&!rl&&r
081
MC/DC50%1/2
defined $weak_invo and not $weak_invo->is_ready
defined $weak_invo not $weak_invo->is_ready
Truth table66%2/3
A and not(B)
A= defined $weak_invoB= not $weak_invo->is_ready
ABresult
0X0
100
111
252
253 27 });
254 }
255 53 return $next_future;
256 }
257  
258 20 1;
259  
260 __END__
↑ Summary