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

filter: Statementstmt 96.8% 31 / 32 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 5 totaltotal 85.7% 42 / 49 CC 2 SCAR 1.9
CC
2
Cov
94%
map
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« blib/lib/App/RecordStream/Aggregator/Concatenate.pm ↑ Summary blib/lib/App/RecordStream/Aggregator/Internal/Ord2BivariateMap.pm »
1 package App::RecordStream::Aggregator::MapReduce::Field;
2  
3 12 our $VERSION = "4.0.23";
4  
5 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 12 ▶use App::RecordStream::Aggregator::MapReduce;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 12 ▶use App::RecordStream::DomainLanguage::Valuation::KeySpec;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 12 ▶use base 'App::RecordStream::Aggregator::MapReduce';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 sub new
14 {
15 12 ▶ my $class = shift;
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
16 12 my $field = shift;
17  
18 12 return new_from_valuation($class, App::RecordStream::DomainLanguage::Valuation::KeySpec->new($field));
19 }
20  
21 sub new_from_valuation
22 {
23 37 ▶ my $class = shift;
Subroutine new_from_valuation: called CC=1 SCAR=0.0
Pod undocumented
24 37 my $valuation = shift;
25  
26 37 my $this =
27 {
28 'valuation' => $valuation,
29 };
30 37 bless $this, $class;
31  
32 37 return $this;
33 }
34  
35 sub map
36 {
37 98 ▶ my ($this, $record) = @_;
Subroutine map: called CC=2 SCAR=7.6
Pod undocumented
38  
39 98 ▶ if(!defined($this->{'valuation'}))
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $this->{"valuation"}) 0 98 98
40 {
41 # oopsie, consider missing/undef fields not to count and return the empty cookie
42 0 return undef;
43 }
44 98 return $this->map_field($this->{'valuation'}->evaluate_record($record));
45 }
46  
47 sub map_field
48 {
49 65 ▶ my ($this, $value) = @_;
Subroutine map_field: called CC=1 SCAR=0.0
Pod undocumented
50  
51 65 return $value;
52 }
53  
54 sub argct
55 {
56 5 ▶ return 1;
Subroutine argct: called CC=1 SCAR=0.0
Pod undocumented
57 }
58  
59 12 1;
« blib/lib/App/RecordStream/Aggregator/Concatenate.pm ↑ Summary blib/lib/App/RecordStream/Aggregator/Internal/Ord2BivariateMap.pm »