blib/lib/Cassandra/Client/Util.pm

filter: Statementstmt 78.4% 40 / 51 Branchbran 50.0% 6 / 12 Conditioncond 33.3% 2 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 81.8% 9 / 11 Podpod 0.0% 0 / 3 totaltotal 66.6% 58 / 87 CC 10 SCAR 14.4
CC
10
Cov
70%
__ANON__
12.0
__ANON__
5.3
parallel
3.4
CRAP 4.2
« blib/lib/Cassandra/Client/Policy/Auth/Password.pm ↑ Summary blib/lib/Cassandra/Client/ResultSet.pm »
1 package Cassandra::Client::Util;
2 14 our $AUTHORITY = 'cpan:TVDW';
3 14 $Cassandra::Client::Util::VERSION = '0.21';
4 14 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 14 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 14 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 14 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 14 our @EXPORT= ('series', 'parallel', 'whilst');
10  
11 14 ▶use Sub::Current;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶sub series {
Subroutine series: called CC=1 SCAR=0.0
Pod undocumented
14 1 my $list= shift;
15 1 my $final= shift;
16  
17 3 ▶ (shift @$list)->(sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
18 3 my $next= shift @$list;
19 3 ▶ if ($next && !$_[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($next and not $_[0]) 2 1 3
Condition66%2/3
$next and not $_[0]
!ll&&!rl&&r
102
MC/DC50%1/2
$next and not $_[0]
$next not $_[0]
Truth table66%2/3
A and not(B)
A= $nextB= not $_[0]
ABresult
0X0
100
111
20 2 splice @_, 0, 1, ROUTINE();
21 2 goto &$next;
22 }
23  
24 1 goto &$final;
25 1 });
26  
27 1 return;
28 }
29  
30 1 ▶sub parallel {
Subroutine parallel: called CC=3 SCAR=12.2
Pod undocumented
31 1 my ($list, $final)= @_;
32  
33 1 ▶ if (!@$list) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@$list) 0 1 1
34 0 return $final->();
35 }
36  
37 1 my $remaining= 0+@$list;
38 1 my @result;
39 1 for my $i (0..$#$list) {
40 3 ▶ $list->[$i]->(sub {
Subroutine __ANON__: called CC=4 SCAR=16.8
41 3 my ($error, $result)= @_;
42 3 ▶ if ($error) {
Branch: 1 branch
BranchTrueFalseTotal
if ($error) 0 3 3
43 0 ▶ if ($remaining > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($remaining > 0) 0 0 0
44 0 $remaining= 0;
45 0 $final->($error);
46 }
47 0 return;
48 }
49  
50 3 $result[$i]= $result;
51  
52 3 $remaining--;
53 3 ▶ if ($remaining == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($remaining == 0) 1 2 3
54 1 $final->(undef, @result);
55 }
56 3 });
57 }
58  
59 1 return;
60 }
61  
62 0 ▶sub whilst {
Subroutine whilst: not called CC=1 SCAR=6.9
Pod undocumented
63 0 my ($condition, $iteratee, $callback)= @_;
64  
65 0 ▶ (sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
66 0 ▶ if (defined $_[0] || !($condition->())) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0] or not &$condition()) 0 0 0
Condition0%0/3
defined $_[0] or not &$condition()
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $_[0] or not &$condition()
defined $_[0] not &$condition()
Truth table0%0/3
A or not(B)
A= defined $_[0]B= not &$condition()
ABresult
1X1
011
000
67 0 goto &$callback;
68 }
69 0 splice @_, 0, 1, ROUTINE();
70 0 goto &$iteratee;
71 0 })->();
72 }
73  
74 14 1;
75  
76 __END__
« blib/lib/Cassandra/Client/Policy/Auth/Password.pm ↑ Summary blib/lib/Cassandra/Client/ResultSet.pm »