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.25";
4              
5 6     6   3611 use strict;
  6         14  
  6         144  
6 6     6   23 use warnings;
  6         11  
  6         129  
7              
8 6     6   421 use App::RecordStream::Aggregator::InjectInto::Field;
  6         40  
  6         130  
9 6     6   37 use App::RecordStream::DomainLanguage::Registry;
  6         11  
  6         143  
10              
11 6     6   24 use base qw(App::RecordStream::Aggregator::InjectInto::Field);
  6         13  
  6         1244  
12              
13             #sub new -- passed through
14              
15             #sub new_from_valuation -- passed through
16              
17             sub combine_field
18             {
19 18     18 0 30 my $this = shift;
20 18         21 my $cookie = shift;
21 18         28 my $value = shift;
22              
23 18 100       50 return $value unless ( defined $cookie );
24              
25 12 100       26 if ( $cookie < $value )
26             {
27 5         16 return $value;
28             }
29              
30 7         22 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;