Average(3pm)

๐Ÿ“ฆ version 2.1.1, in arch rolling

๐ŸŽ€ 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-fields attribute. 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 (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