man Lire::Average () - Lire::Average

NAME

Lire::Average

SYNOPSIS

FIXME

DESCRIPTION

Class that implements the avg operator. This operator will compute the average value of a DLF field in a group of DLF records.

If the field used by average isn't a numeric fields, the number of different values in that field will be used as the numerator.

It's possible to compute a weighted average by specifying a weighting field.

By default, the average is a by record average. It's possible to compute a by different values average. The list of fields that's used to determine the different values if speficied in the by-fields attribute.

METHODS

Creates a new Lire::Average object. In addition to the values supported by its parents, the by-fields and weight attributes will be initialized to the values specified in the CW%params argument.

by_fields( [$new_by_fields] )

Returns the fields that are going to be used to count the different values which will made up the by part of the average.

This a reference to an array of DLF field names.

If the CW$new_by_fields parameter is set, it will be used as the new CW$by_fields value. It must be an array reference and should only contains valid field names for the current report specification's schema.

weigth( [$new_weight] )

Returns the DLF field's name by which the values will be multiplied before being summed.

You can change the weight field by specifying a new name as the CW$new_weight parameter. Use undef to remove the use of a weighting field.

SEE ALSO

AUTHORS

 Francis J. Lacoste <flacoste@logreport.org>
 Wolfgang Sourdeau <wsourdea@logreport.org>

VERSION

$Id: Average.pm,v 1.13 2004/07/02 16:09:24 flacoste Exp $

COPYRIGHT

Copyright (C) 2001-2004 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 or write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.