blib/lib/App/RecordStream/Aggregator/MapReduce.pm

filter: Statementstmt 88.8% 24 / 27 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 77.7% 7 / 9 Podpod 0.0% 0 / 6 totaltotal 73.9% 34 / 46 CC 3 SCAR 5.6
CC
3
Cov
87%
combine
3.1
map
2.0
reduce
2.0
CRAP 1.7
« blib/lib/App/RecordStream/Deaggregator/Split.pm ↑ Summary blib/lib/App/RecordStream/Executor/Getopt.pm »
1 package App::RecordStream::Aggregator::MapReduce;
2  
3 17 our $VERSION = "4.0.23";
4  
5 17 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 17 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 17 ▶use base qw(App::RecordStream::Aggregator::Aggregation);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 sub new
11 {
12 28 ▶ my $class = shift;
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
13  
14 28 my $this = { };
15 28 bless $this, $class;
16  
17 28 return $this;
18 }
19  
20 sub initial
21 {
22 134 ▶ return undef;
Subroutine initial: called CC=1 SCAR=0.0
Pod undocumented
23 }
24  
25 sub combine
26 {
27 430 ▶ my ($this, $cookie, $record) = @_;
Subroutine combine: called CC=3 SCAR=11.2
Pod undocumented
28  
29 430 my $cookie2 = $this->map($record);
30  
31 # treat undef on either side as empty and return the other
32 430 ▶ if(!defined($cookie))
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $cookie) 137 293 430
33 {
34 137 return $cookie2;
35 }
36 293 ▶ if(!defined($cookie2))
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $cookie2) 0 293 293
37 {
38 0 return $cookie;
39 }
40  
41 # if they're both non-undef then combine them
42 293 return $this->reduce($cookie, $cookie2);
43 }
44  
45 sub squish
46 {
47 104 ▶ my ($this, $cookie) = @_;
Subroutine squish: called CC=1 SCAR=0.0
Pod undocumented
48  
49 104 return $cookie;
50 }
51  
52 sub map
53 {
54 0 ▶ die "MapReduce subclass did not implement map.\n";
Subroutine map: not called CC=1 SCAR=6.9
Pod undocumented
55 }
56  
57 sub reduce
58 {
59 0 ▶ die "MapReduce subclass did not implement reduce.\n";
Subroutine reduce: not called CC=1 SCAR=6.9
Pod undocumented
60 }
61  
62 17 1;
« blib/lib/App/RecordStream/Deaggregator/Split.pm ↑ Summary blib/lib/App/RecordStream/Executor/Getopt.pm »