Report(3)

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";
    print "Hostname: ", $report->hostname, "\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 comply with the Lire Report Markup Language DTD.

CONSTRUCTOR
A Lire::Report object can be built from a XML report file, from the new method or from a Lire::ReportConfig object.

  new( $superservice, $timespan_start, $timespan_end )
Creates a new Lire::Report. The $superservice, $timespan_start and $timespan_end parameters initialized 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 currently should always be 1.0.

  generator([$generator)
Returns the generator string that will be outputted in comments when the write_report() method is used. You can change that value by passing a new value through the $generator parameter.

  superservice()
Returns the superservice of this report.

  hostname([$hostname])
Returns the hostname of this report.

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

  date()
Returns the date in seconds since epoch on which this report was generated.

  timespan_start()
Returns the start of the timespan covered by this report in seconds since epoch.

  timespan_end()
Returns 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.

  target_users()
Returns an array of all the descriptions defined for this report.

Lire's reports can contains several descriptions, each tailored for a specific class of users like 'sysadmin' or 'manager'. This returns the list of target users' available.

  description( [$target_user], [$description] )
Returns the description for a particular class of user. This should be one of the values returned by target_users(). If the $target_user parameter is missing or the requested class isn't available, the 'default' description will be returned. That's the first one that appears in the XML file.

The description is encoded in DocBook XML.

If the $description parameter is set, this method will set the $target_user 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.

  subreports_by_type( $type )
Returns all the subreports of a the type $type. The subreport's type is the id of the report specification used to compute the reports. This will search for subreports with this type in all the report's sections. The subreports are returned as an array of Lire::Report::Subreport objects.

  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
Lire::ReportParser::ReportBuilder(3pm) Lire::Report::Section(3pm) Lire::Report::Subreport(3pm) Lire::Report::Entry(3pm) Lire::Report::Group(3pm)

Lire::ReportParser(3pm)

VERSION
$Id: Report.pm,v 1.5 2002/07/28 19:29:11 flacoste 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 or write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.

AUTHOR
Francis J. Lacoste <flacoste@logreport.org>