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

filter: Statementstmt 97.7% 43 / 44 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.9% 10 / 11 Podpod 0.0% 0 / 6 totaltotal 87.3% 55 / 63 CC 4 SCAR 5.0
CC
4
Cov
98%
key_clumper_push_record
3.0
long_usage
2.0
key_clumper_end
2.0
CRAP 1.6
« blib/lib/App/RecordStream/Test/Tester.pm ↑ Summary blib/lib/App/RecordStream/Operation/multiplex/BaseClumperCallback.pm »
1 package App::RecordStream::Clumper::KeyPerfect;
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;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use App::RecordStream::DomainLanguage::Registry;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 5 ▶use base 'App::RecordStream::Clumper::Key';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 sub long_usage
12 {
13 0 ▶ return <<EOF;
Subroutine long_usage: not called CC=1 SCAR=6.9
Pod undocumented
14 Usage: keyperfect,<keyspec>
15 Clump records by the value for a key
16 EOF
17 }
18  
19 sub short_usage
20 {
21 2 ▶ return "clump records by the value for a key";
Subroutine short_usage: called CC=1 SCAR=0.0
Pod undocumented
22 }
23  
24 sub key_clumper_begin
25 {
26 20 ▶ return [[], {}];
Subroutine key_clumper_begin: called CC=1 SCAR=0.0
Pod undocumented
27 }
28  
29 sub key_clumper_push_record
30 {
31 95 ▶ my $this = shift;
Subroutine key_clumper_push_record: called CC=3 SCAR=11.0
Pod undocumented
32 95 my $cookie = shift;
33 95 my $value = shift;
34 95 my $record = shift;
35 95 my $next = shift;
36  
37 95 for my $value ($this->get_values($value))
38 {
39 125 my $next_cookie = $cookie->[1]->{$value};
40 125 ▶ if(!defined($next_cookie))
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $next_cookie) 47 78 125
41 {
42 47 push @{$cookie->[0]}, $value;
43 47 $next_cookie = $cookie->[1]->{$value} = $next->key_clumper_callback_begin_value($value);
44 }
45  
46 125 $next->key_clumper_callback_push_record($next_cookie, $record);
47 }
48 }
49  
50 sub get_values
51 {
52 65 ▶ my $this = shift;
Subroutine get_values: called CC=1 SCAR=0.0
Pod undocumented
53 65 my $value = shift;
54  
55 65 return ($value);
56 }
57  
58 sub key_clumper_end
59 {
60 19 ▶ my $this = shift;
Subroutine key_clumper_end: called CC=2 SCAR=6.9
Pod undocumented
61 19 my $cookie = shift;
62 19 my $next = shift;
63  
64 19 for my $value (@{$cookie->[0]})
65 {
66 46 my $next_cookie = $cookie->[1]->{$value};
67 46 $next->key_clumper_callback_end($next_cookie);
68 }
69 }
70  
71 5 App::RecordStream::Clumper->register_implementation('keyperfect', __PACKAGE__);
72  
73 5 App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'keyperfect', 'VALUATION');
74 5 App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'key', 'VALUATION');
75  
76 5 1;
« blib/lib/App/RecordStream/Test/Tester.pm ↑ Summary blib/lib/App/RecordStream/Operation/multiplex/BaseClumperCallback.pm »