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.
new( [ $timespan_period ], [ $timespan_start ], [ $timespan_end ]
)¶
Creates a new Lire::Report. The $timespan_period, $timespan_start and
$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. The current version is 2.1.
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 $generator parameter.
date( [ $new_date ] )¶
Returns (and optionanly changes) the date in seconds since epoch on which this
report was generated.
timespan_period( [ $new_period ] )¶
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.
timespan_start( [ $new_start ] )¶
Returns (and optionnally changes) the start of the timespan covered by this
report in seconds since epoch.
timespan_end( [ $new_end ] )¶
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 $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 $description parameter is set, this method will set the description to
this new value. If the $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.
add_section( $section )¶
Adds a section to this report. The $section parameter should be a
Lire::Report::Section object.
subreport_by_id( $id )¶
Returns the Lire::Report::Subreport object with $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.
This method takes care of adding stuff like the XML header "<?xml
version=[...]". It encodes the XML report in UTF-8, using
Lire::I18N::set_fh_encoding().
delete( )¶
Removes all circular references so that the object can be freed.
SEE ALSO¶
Lire::ReportParser::ReportBuilder(3pm)
Lire::Report::Section(3pm)
Lire::Report::Subreport(3pm)
Lire::Report::Entry(3pm)
Lire::Report::Group(3pm)
Lire::ReportParser(3pm)
AUTHOR¶
Francis J. Lacoste <flacoste@logreport.org>
VERSION¶
$Id: Report.pm,v 1.35 2006/07/23 13:16:29 vanbaal 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.