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.23";
4              
5 6     6   3746 use strict;
  6         17  
  6         159  
6 6     6   30 use warnings;
  6         12  
  6         145  
7              
8 6     6   468 use App::RecordStream::Aggregator::InjectInto::Field;
  6         15  
  6         119  
9 6     6   32 use App::RecordStream::DomainLanguage::Registry;
  6         13  
  6         154  
10              
11 6     6   32 use base qw(App::RecordStream::Aggregator::InjectInto::Field);
  6         16  
  6         1189  
12              
13             #sub new -- passed through
14              
15             #sub new_from_valuation -- passed through
16              
17             sub combine_field
18             {
19 18     18 0 25 my $this = shift;
20 18         28 my $cookie = shift;
21 18         23 my $value = shift;
22              
23 18 100       55 return $value unless ( defined $cookie );
24              
25 12 100       28 if ( $cookie < $value )
26             {
27 5         18 return $value;
28             }
29              
30 7         20 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;