blib/lib/App/RecordStream/Clumper/Key.pm

filter: Statementstmt 97.9% 47 / 48 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 12 / 12 Podpod 0.0% 0 / 7 totaltotal 86.9% 60 / 69 CC 2 SCAR 1.5
CC
2
Cov
96%
evaluate_record
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« blib/lib/App/RecordStream/Aggregator/Records.pm ↑ Summary blib/lib/App/RecordStream/Aggregator/UniqArray.pm »
1 package App::RecordStream::Clumper::Key;
2  
3 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 5 ▶use App::RecordStream::Clumper::Key::WrappedCallback;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use App::RecordStream::Clumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 5 ▶use base 'App::RecordStream::Clumper';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 sub new
12 {
13 7 ▶ my $class = shift;
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
14 7 my $field = shift;
15  
16 7 return new_from_valuation($class, $field, App::RecordStream::DomainLanguage::Valuation::KeySpec->new($field));
17 }
18  
19 sub new_from_valuation
20 {
21 20 ▶ my $class = shift;
Subroutine new_from_valuation: called CC=1 SCAR=0.0
Pod undocumented
22 20 my $name = shift;
23 20 my $valuation = shift;
24  
25 20 my $this =
26 {
27 'name' => $name,
28 'valuation' => $valuation,
29 };
30 20 bless $this, $class;
31  
32 20 return $this;
33 }
34  
35 sub evaluate_record
36 {
37 157 ▶ my $this = shift;
Subroutine evaluate_record: called CC=2 SCAR=7.2
Pod undocumented
38 157 my $record = shift;
39  
40 157 my $v = $this->{'valuation'}->evaluate_record($record);
41 157 ▶ if(!defined($v))
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $v) 0 157 157
42 {
43 0 $v = "";
44 }
45  
46 157 return $v;
47 }
48  
49 sub clumper_begin
50 {
51 31 ▶ my $this = shift;
Subroutine clumper_begin: called CC=1 SCAR=0.0
Pod undocumented
52 31 my $bucket = shift;
53  
54 31 return [$bucket, $this->key_clumper_begin()];
55 }
56  
57 sub clumper_push_record
58 {
59 157 ▶ my $this = shift;
Subroutine clumper_push_record: called CC=1 SCAR=0.0
Pod undocumented
60 157 my $cookie = shift;
61 157 my $record = shift;
62 157 my $next = shift;
63  
64 157 my $name = $this->{'name'};
65 157 my $value = $this->evaluate_record($record);
66  
67 157 my $wrapped_next = App::RecordStream::Clumper::Key::WrappedCallback->new($next, $cookie->[0], $name, $value);
68  
69 157 $this->key_clumper_push_record($cookie->[1], $value, $record, $wrapped_next);
70 }
71  
72 sub clumper_end
73 {
74 30 ▶ my $this = shift;
Subroutine clumper_end: called CC=1 SCAR=0.0
Pod undocumented
75 30 my $cookie = shift;
76 30 my $next = shift;
77  
78 30 my $wrapped_next = App::RecordStream::Clumper::Key::WrappedCallback->new($next, undef);
79  
80 30 $this->key_clumper_end($cookie->[1], $wrapped_next);
81 }
82  
83  
84 sub argct
85 {
86 2 ▶ return 1;
Subroutine argct: called CC=1 SCAR=0.0
Pod undocumented
87 }
88  
89 5 1;
« blib/lib/App/RecordStream/Aggregator/Records.pm ↑ Summary blib/lib/App/RecordStream/Aggregator/UniqArray.pm »