/usr/share/perl5/Lire/Max.pm is in lire 2:2.1.1-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | package Lire::Max;
use strict;
use base qw/ Lire::SimpleStat /;
use Carp;
use Lire::Utils qw/ sql_quote_name /;
=pod
=head1 NAME
Lire::Max - Lire class that implements the max operator
=head1 SYNOPSIS
use Lire::Max
=head1 DESCRIPTION
Class that implements the max operator. This operator will find the
minimum value appearing in a DLF field among a group of DLF records.
=head1 METHODS
=head2 new( %params )
Creates a new Lire::Max object.
=cut
sub new {
my $self = bless {}, shift;
$self->init( @_, 'op' => 'max' );
return $self;
}
# Implements Lire::Aggregate::sql_aggr_expr
sub sql_aggr_expr {
my $self = $_[0];
return 'max(' . sql_quote_name( $self->{'field'} ) . ')';
}
# Implements Lire::ReportOperator::init_group_data
sub init_group_data {
my $scalar = undef;
return \$scalar;
}
# Implements Lire::ReportOperator::merge_group_data
sub merge_group_data {
my ( $self, $value, $data ) = @_;
return if lc $value->{'value'} eq 'nan';
$$data = $value->{'value'}
unless ( defined $$data );
# To merge two max, we keep the highest
$$data = $value->{'value'}
if $value->{'value'} > $$data;
return;
}
# Implements Lire::ReportOperator::end_group_data
sub end_group_data {
my ( $self, $data ) = @_;
$$data = "NaN" unless defined $$data;
return;
}
# keep perl happy
1;
__END__
=head1 SEE ALSO
Lire::ReportSpec(3pm), Lire::ReportOperator(3pm), Lire::Aggregator(3pm), Lire::Aggregate(3pm).
=head1 AUTHOR
Francis J. Lacoste <flacoste@logreport.org>
=head1 VERSION
$Id: Max.pm,v 1.10 2008/03/09 19:27:31 vanbaal Exp $
=head1 COPYRIGHT
Copyright (C) 2001, 2002 Stichting LogReport Foundation LogReport@LogReport.org
This file is part of Lire.
Lire is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program (see COPYING); if not, check with
http://www.gnu.org/copyleft/gpl.html.
=cut
|