man Lire::Report () - Interface to a Lire report.

NAME

Lire::Report - Interface to a Lire report.

SYNOPSIS

    use Lire::ReportParser::ReportBuilder;
    my $parser = new Lire::ReportParser::ReportBuilder;
    my $report = $parser->parse( "report.xml" );

    print $report->superservice(), " report\n";
    print "Generated on ", scalar( localtime( $report->date() ) ), "\n";
    print "Timespan starts on ", scalar( localtime( $report->timespan_start() ) ), "\n";
    print "Timespan ends on ", scalar( localtime( $report->timespan_start() ) ), "\n";
    foreach my $s ( $report->sections() ) {
        print "Section: '", $s->title(), "' has ", scalar $s->subreports(),
            " subreports in it\n";
    }

DESCRIPTION

This module offers an API to the report generated by Lire. The Lire::ReportParser::ReportBuilder(3pm) can be used to create a Lire::Report object from an XML file that complies with the Lire Report Markup Language DTD.

CONSTRUCTOR

A Lire::Report object can be built from an XML report file, from the new() method or from a Lire::ReportConfig object. Creates a new Lire::Report. The CW$timespan_period, CW$timespan_start and CW$timespan_end parameters initialize the attributes of the same name.

OBJECT METHODS

version()

Returns the version number of the report format which was used in the external representation of this report. This is alway 2.0.

generator([$generator)

Returns the generator string that will be outputted in comments when the write_report() method is used. One can change that value by passing a new value through the CW$generator parameter. Returns (and optionanly changes) the date in seconds since epoch on which this report was generated. Returns (and optionnally changes) the period of the report. The period can be 'hourly', 'daily', 'weekly', 'monthly' or 'yearly'. When the period is undef, it is an arbitrary period. Returns (and optionnally changes) the start of the timespan covered by this report in seconds since epoch. Returns (and optionnally changes) the end of the timespan covered by this report in seconds since epoch.

title( [$title] )

Returns the report's title, if it has one.

If the CW$title is parameter is set, the report's title will be set to this new value.

description( [$new_desc] )

Returns the report description. This description is encoded in DocBook XML.

If the CW$description parameter is set, this method will set the description to this new value. If the CW$description parameter is undef, that description will be removed.

sections( )

Returns the report's sections as an array. This will be an array of Lire::Report::Section objects. Adds a section to this report. The CW$section parameter should be a Lire::Report::Section object. Returns the Lire::Report::Subreport object with CW$id. Returns undef when there is no subreport with that ID.

schemas()

Returns an array reference containing all the schemas used by this report.

write_report( [FH] );

Write the report in XML format on the FH filehandle or STDOUT if omitted.

delete( )

Removes all circular references so that the object can be freed.

SEE ALSO

AUTHOR

  Francis J. Lacoste <flacoste@logreport.org>

VERSION

$Id: Report.pm,v 1.33 2004/08/23 19:06:55 flacoste Exp $

COPYRIGHT

Copyright (C) 2002, 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.