Subreport(3)

NAME
Lire::Subreport - Interface to a Lire subreport.

SYNOPSIS
    use Lire::ReportParser::ReportBuilder;
    my $parser = new Lire::ReportParser::ReportBuilder;
    my $report = $parser->parse( "report.xml" );
    foreach my $s ( $report->sections ) {
        print "Section: '", $s->title, "\n\n";
        foreach my $r ( $s->subreports ) {
            print "Subreport ", $r->title, " has ", scalar $r->entries,
                " entries\n";
        }
    }

DESCRIPTION
This module offers an API to the subreports included in the sections of a Lire's report.

CONSTRUCTORS

  new( $report, $type)
Creates a new Lire::Report::Subreport object. The $type parameter is the id of the report specification that is used to generate this subreport's data. The $report parameter is of type Lire::Report and is used to fill in the timespan, superservice and type attributes of the subreport.

  new_missing( $report, $type, [$reason])
Creates a new Lire::Report::Subreport object marked as missing. The $type parameter is the id of the report specification that is used to generate this subreport's data. The $report parameter is of type Lire::Report and is used to fill in the timespan, superservice and type attributes of the subreport. The $reason parameter sets the reason why this subreport is missing.

OBJECT METHODS

  superservice()
Returns the superservice of this subreport. This is usually identical to the report's value.

  is_missing()
Returns true if this subreport was marked as missing in the XML file. A missing subreport is a subreport which was present in the report configure file but which was marked as missing in the XML report. This happens when the report specification requires fields that weren't available in the DLF files generated. It can also happen when an error occurs in the report generation process.

  missing_reason()
Reports why the subreport is missing. This will be undefined when the subreport is not missing.

  type()
Returns the type of this subreport. This is the ID of the report specification that was used to generate this subreport.

  charttype( [$new_type] )
Returns the suggested chart's type for this subreport. If the $new_type parameter is set, this subreport's charttype attribute will be modified accordingly.

  hostname([$hostname])
Returns the hostname of this subreport. This is usually identical to the report's value.

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

  date()
Returns the date in seconds since epoch on which this subreport was generated. This is usually identical to the report's value.

  timespan_start()
Returns the start of the timespan covered by this subreport in seconds since epoch. This is usually identical to the report's value.

  timespan_end()
Returns the end of the timespan covered by this subreport in seconds since epoch. This is usually identical to the report's value.

  title( [$title] )
Returns the subreport's title.

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

  target_users()
Returns the user class supported by the descriptions of this subreport.

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] )
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.

  show( [$show] )
Returns the number of entries that should be displayed in the report. There may be more entries than that in the subreport. When this parameter is zero or undefined, all available entries should be displayed.

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

  entries()
Returns the subreport's entries as an array. This will be an array of Lire::Report::Entry objects.

  add_entry( $entry )
Adds a data entry to this subreport. The $entry parameter should be a Lire::Report::Entry object.

  image( [$image] )
If an image was generated for this subreport, this methods returns the Lire::Report::Image that contains the image's information.

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

SEE ALSO
Lire::ReportParser::ReportBuilder(3pm) Lire::Report::Section(3pm) Lire::Report::Report(3pm) Lire::Report::Entry(3pm), Lire::Report::Group(3pm), Lire::Report::Image(3pm)

VERSION
$Id: Subreport.pm,v 1.4 2002/06/18 19:27:21 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>