RowColHandler(3pm)

πŸ“¦ version 2.1.1, in arch rolling

πŸ’… RowColHandler(3pm)

ok so first things first: this is a page from LogReport's Lire Documentation, and the star of the show is Lire::ReportParser::RowColHandler β€” a Lire::ReportParser subclass that, bestie, synthetizes rows for you ✨


🌸 NAME

Lire::ReportParser::RowColHandler β€” a Lire::ReportParser subclass which synthetize row πŸŽ€


πŸ¦‹ SYNOPSIS

so when you're writing XML Report processors, it looks like this:

package MyParser;

use base qw/Lire::ReportParser::RowColHandler/;

sub handle_header_row {
    my ( $self, $row ) = @_;

    ...
}

sub handle_row {
    my ( $self, $row ) = @_;

    ...
}

sub handle_table_summary {
    my ( $self, $nrecords, $row ) = @_;

    ....
}

πŸ’– DESCRIPTION

okay so the Lire::ReportParser::RowColHandler module is a Lire::ReportParser subclass, and what it does is synthetize handle_row() events for you πŸ”₯ that's the whole vibe.

why does that matter? because it makes writing subclasses so much easier when the only point of the subclass is to format the report. like, instead of having to reconstruct the table row yourself out of the various entry_start, group_start, handle_name, events (ugh, exhausting), your subclass only has to process the handle_row() events. that's it. iconic behaviour honestly πŸ‘‘


✨ USING Lire::ReportParser::RowColHandler ✨

clients only have to inherit from Lire::ReportParser::RowColHandler. after that? you can define handle_row(), handle_header_row() and handle_table_summary() methods. slay 🫢

there's one parameter that RowColHandler accepts, and it's called "summary_when" β€” it specifies when the handle_table_summary() event will be synthetised. your options are "before" or "after" the table's body:

  • when it's "before", the event gets generated after the header_row events but before any handle_row() events.
  • otherwise, it gets generated once all handle_row() events are processed.

the default is "before". noted. πŸ’…

πŸŽ€ handle_table_summary( $nrecords, $row )

called after the table summary is available (and depending on the "summary_when" initialisation parameter, remember her).

  • $nrecords contains the number of records used to compute the report.
  • $row is an array reference to the table summary value.

the $row array contains as many elements as there are columns in the table. only the numerical column will have a value in there β€” the others will be set to undef.

the summary values are hash references containing the same values that are available in Lire::ReportParser's handle_summary_value() event. iykyk πŸ’œ

🌈 handle_header_row( $row )

this will be called once for each header row there is. the first header row contains all the numerical columns as well as the main categorical column.

$row is an array reference containing as many elements as there are columns in the table. column's labels which shouldn't appear on this row are undef. other elements will contain the related Lire::Report::ColumnInfo object ✨

πŸ“ handle_row( $row )

this event will be called for each row to display in the table.

$row is an array reference containing the data that should appear in the row. it contains as many elements as there are columns defined in the table. empty columns will have undef as content. other elements will be a hash reference identical to what would be received in the handle_name() or handle_value() method of Lire::ReportParser. the only difference? summary values will have a key "is_summary" set to 1 πŸ‘€

in the case of spanning columns, the data element will be in the col_start() element. the other cells will be undef. no cap.


πŸ‘€ SEE ALSO


🧚 VERSION

$Id: RowColHandler.pm,v 1.13 2006/07/23 13:16:31 vanbaal Exp $

copyright (C) 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. 😭 (yes that's the dramatic part, read it fr fr)

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.


πŸ‘‘ AUTHOR

Francis J. Lacoste <flacoste@logreport.org>


and that's the whole page bestie πŸ’– this was Lire 2.1.1, dated 2025-09-28, and the page itself is RowColHandler(3pm) β€” go forth and synthesize those rows, you've got this πŸ¦‹βœ¨πŸŽ€

πŸ“¦ where this page comes from