File Coverage

blib/lib/App/RecordStream/Aggregator/Minimum.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::Minimum;
2              
3             our $VERSION = "4.0.25";
4              
5 6     6   4056 use strict;
  6         12  
  6         153  
6 6     6   23 use warnings;
  6         21  
  6         121  
7              
8 6     6   421 use App::RecordStream::Aggregator::InjectInto::Field;
  6         11  
  6         124  
9 6     6   28 use App::RecordStream::DomainLanguage::Registry;
  6         12  
  6         127  
10              
11 6     6   32 use base qw(App::RecordStream::Aggregator::InjectInto::Field);
  6         15  
  6         1273  
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         22 my $cookie = shift;
21 18         21 my $value = shift;
22              
23 18 100       46 return $value unless ( defined $cookie );
24              
25 12 100       22 if ( $cookie > $value )
26             {
27 5         13 return $value;
28             }
29              
30 7         20 return $cookie;
31             }
32              
33             sub short_usage
34             {
35 0     0 0   return "minimum value for a field";
36             }
37              
38             sub long_usage
39             {
40 0     0 0   return <
41             Usage: min,
42             Minimum value of specified field.
43             EOF
44             }
45              
46             App::RecordStream::Aggregator->register_implementation('minimum', __PACKAGE__);
47             App::RecordStream::Aggregator->register_implementation('min', __PACKAGE__);
48              
49             App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'minimum', 'VALUATION');
50             App::RecordStream::DomainLanguage::Registry::register_vfn(__PACKAGE__, 'new_from_valuation', 'min', 'VALUATION');
51              
52             1;