Average(3pm)
๐ Average(3pm) โ like, the Lire::Average glow-up ๐
okay bestie, so this is a page from LogReport's Lire Documentation and it's all about Lire::Average โ the Lire class that implements the avg operator. she's a little perl module with big main character energy ๐
โจ SYNOPSIS โจ
use Lire::Average
that's it, that's the whole vibe check. one line. slay. ๐ซถ
๐ DESCRIPTION ๐
so Lire::Average is the class that implements the avg operator, periodt. what does that mean? it computes the average value of a DLF field across a group of DLF records. numbers going in, one number coming out. iconic behaviour fr fr.
here's the tea though, and this part is important: ๐ซ
- if the field that average is using isn't a numeric field, then the number of different values in that field gets used as the numerator. like, that's just the rule. no cap.
- you can compute a weighted average by specifying a weighting field. go off, mathematician ๐
- by default, the average is a by record average. but it's also possible to compute a by different values average โ the list of fields used to determine those different values is specified in the
by-fieldsattribute. iykyk.
๐ธ METHODS ๐ธ
new( %params )
creates a shiny new Lire::Average object. โจ and here's the extra bit: on top of all the values supported by its parents, the by-fields and weight attributes get initialized to whatever you specified in the %params argument. so pass your params, get your object, live your truth.
by_fields( [$new_by_fields] )
returns the fields that are gonna be used to count the different values โ those are the ones that make up the by part of the average. ๐งฎ
this is a reference to an array of DLF field names. (yes, an array ref. keep that in mind.)
if you set the $new_by_fields parameter, it gets used as the new $by_fields value. requirements bestie: it must be an array reference, and it should only contain valid field names for the current report specification's schema. no random field names, okay? the schema is watching ๐
weigth( [$new_weight] )
(yes, it's spelled weigth โ that's the method name, i don't make the rules, i just report them ๐)
returns the DLF field's name by which the values will be multiplied before being summed. that's the weighting field in action, babes.
you can change the weight field by specifying a new name as the $new_weight parameter. and if you wanna drop weighting entirely? pass undef to remove the use of a weighting field. very clean, very demure. ๐
๐ฅ SEE ALSO ๐ฅ
go read these, they're the friends in this module's group chat:
๐ AUTHORS ๐
the legends who wrote this:
- Francis J. Lacoste <flacoste@logreport.org>
- Wolfgang Sourdeau <wsourdea@logreport.org>
๐ฆ VERSION ๐ฆ
$Id: Average.pm,v 1.17 2008/03/09 19:27:30 vanbaal 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. โ ๏ธ seriously, no warranty, that's the deal.
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.
genuinely go read COPYING if you don't have it โ the FSF wants you to have it, and honestly? respect the paperwork. ๐
okay that's the whole page, you ate that ๐ and to close it out with the boring-but-official bits: this was Lire 2.1.1, dated 2025-09-28, and the manual page is Average(3pm). mwah, go compute some averages ๐โจ
๐ฆ where this page comes from
- arch rolling: lire 2.1.1-8 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms