RowColHandler(3pm)

NAME
Lire::ReportParser::RowColHandler - Lire::ReportParser subclass which synthetize row

SYNOPSIS
In XML Report processors:

    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
The Lire::ReportParser::RowColHandler module is a Lire::ReportParser subclass which will synthetize handle_row() events. This makes it easier to write subclases which onlypurpose is to format the report. Instead of having to reconstruct the table row from the various entry_start, group_start, handle_name, events, the subclass only has to process handle_row() events.

USING Lire::ReportParser::RowColHandler
Client only have to inherit from Lire::ReportParser::RowColHandler. After that, they can define handle_row(), handle_header_row() and handle_table_summary() method.

There is a parameter that the RowColHandler accepts and its "summary_when" which specify when the handle_table_summary() event will be synthetised ( "before" or "after" the table's body.) When it's "before" the event will be generated after the header_row events but before any handle_row() events. Otherwise, it will be generated once all handle_row() events are processed. The default is "before".

  handle_table_summary( $nrecords, $row )
Called after the table summary is available (and depending on the "summary_when" initialisation parameter). $nrecords contains the number of records used to compute the report and $row is an array reference to the table summary value. The $row array contains as much elements as there is columns in the table. Only the numerical column will have a value in there, others will be set to undef.

The summary value are hash reference containing the same values than is available in the Lire::ReportParser's handle_summary_value() event.

  handle_header_row( $row )
This will 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 much element as there is 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 column will have undef as content. Other elements will be an hash reference identical to what would be received in the handle_name() or handle_value() method of Lire::ReportParser. The only difference is that summary value 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.

SEE ALSO
Lire::ReportParser(3pm) Lire::Report::ColumnInfo(3pm)

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

COPYRIGHT
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.

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>