blib/lib/App/RecordStream/Deaggregator/Unarray.pm

filter: Statementstmt 83.3% 35 / 42 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 10 / 12 Podpod 0.0% 0 / 6 totaltotal 75.0% 45 / 60 CC 2 SCAR 2.7
CC
2
Cov
83%
new_from_valuation
2.0
deaggregate_field
2.0
long_usage
2.0
CRAP 1.3
« blib/lib/App/RecordStream/Test/LastHelper.pm ↑ Summary blib/lib/App/RecordStream/Aggregator/FirstRecord.pm »
1 package App::RecordStream::Deaggregator::Unarray;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use App::RecordStream::Deaggregator::Field;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use App::RecordStream::Deaggregator;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use App::RecordStream::DomainLanguage::Registry;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶use base 'App::RecordStream::Deaggregator::Field';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 sub new
13 {
14 1 ▶ my $class = shift;
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
15 1 my $old_field = shift;
16 1 my $new_field = shift;
17  
18 1 my $this = $class->SUPER::new($old_field);
19  
20 1 $this->{'new_field'} = $new_field;
21  
22 1 return $this;
23 }
24  
25 sub new_from_valuation
26 {
27 0 ▶ my $class = shift;
Subroutine new_from_valuation: not called CC=1 SCAR=6.9
Pod undocumented
28 0 my $valuation = shift;
29 0 my $new_field = shift;
30  
31 0 my $this = $class->SUPER::new_from_valuation($valuation);
32  
33 0 $this->{'new_field'} = $new_field;
34  
35 0 return $this;
36 }
37  
38 sub deaggregate_field
39 {
40 1 ▶ my $this = shift;
Subroutine deaggregate_field: called CC=2 SCAR=6.9
Pod undocumented
41 1 my $values = shift;
42  
43 1 my @ret;
44  
45 1 for my $value (@$values)
46 {
47 3 push @ret, {$this->{'new_field'} => $value};
48 }
49  
50 1 return \@ret;
51 }
52  
53 sub long_usage
54 {
55 0 ▶ return <<EOF;
Subroutine long_usage: not called CC=1 SCAR=6.9
Pod undocumented
56 Usage: unarray,<old field>,<new field>
57 Split the array into individual \"element\" records
58 EOF
59 }
60  
61 sub short_usage
62 {
63 1 ▶ return "split the provided array";
Subroutine short_usage: called CC=1 SCAR=0.0
Pod undocumented
64 }
65  
66 sub argct
67 {
68 1 ▶ return 2;
Subroutine argct: called CC=1 SCAR=0.0
Pod undocumented
69 }
70  
71 2 App::RecordStream::Deaggregator->register_implementation('unarray', __PACKAGE__);
72  
73 2 App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'unarray', 'VALUATION', 'SCALAR');
74  
75 2 1;
« blib/lib/App/RecordStream/Test/LastHelper.pm ↑ Summary blib/lib/App/RecordStream/Aggregator/FirstRecord.pm »