File Coverage

blib/lib/App/RecordStream/Aggregator/Maximum.pm
Criterion Covered Total %
statement 22 24 91.6
branch 4 4 100.0
condition n/a
subroutine 6 8 75.0
pod 0 3 0.0
total 32 39 82.0


line stmt bran cond sub pod time code
1             package App::RecordStream::Aggregator::Maximum;
2              
3             our $VERSION = "4.0.24";
4              
5 6     6   2740 use strict;
  6         13  
  6         140  
6 6     6   26 use warnings;
  6         10  
  6         127  
7              
8 6     6   295 use App::RecordStream::Aggregator::InjectInto::Field;
  6         17  
  6         113  
9 6     6   25 use App::RecordStream::DomainLanguage::Registry;
  6         10  
  6         117  
10              
11 6     6   25 use base qw(App::RecordStream::Aggregator::InjectInto::Field);
  6         11  
  6         966  
12              
13             #sub new -- passed through
14              
15             #sub new_from_valuation -- passed through
16              
17             sub combine_field
18             {
19 18     18 0 29 my $this = shift;
20 18         28 my $cookie = shift;
21 18         24 my $value = shift;
22              
23 18 100       53 return $value unless ( defined $cookie );
24              
25 12 100       25 if ( $cookie < $value )
26             {
27 5         18 return $value;
28             }
29              
30 7         25 return $cookie;
31             }
32              
33             sub short_usage
34             {
35 0     0 0   return "maximum value for a field";
36             }
37              
38             sub long_usage
39             {
40 0     0 0   return <
41             Usage: max,
42             Maximum value of specified field.
43             EOF
44             }
45              
46             App::RecordStream::Aggregator->register_implementation('maximum', __PACKAGE__);
47             App::RecordStream::Aggregator->register_implementation('max', __PACKAGE__);
48              
49             App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'maximum', 'VALUATION');
50             App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'max', 'VALUATION');
51              
52             1;