NAME
Data::Report - Framework for flexible reporting
VERSION
0.01
SYNOPSIS
use Data::Report;
# Factory call to create a reporter.
my $rpt = Data::Report->create;
# User API calls.
$rpt->set_layout(...); # define layout
$rpt->start; # start the reporter
$rpt->add(...); # add a row of data
$rpt->add(...); # add a row of data
$rpt->finish; # finish the reporter
DESCRIPTION
Data::Report is a flexible, plugin-driven reporting framework.
This module is the factory that creates reporter objects.
For the documentation of the user API, see Data::Report::API.
For the documentation on writing your own plugins, see Data::Report::Base.
The Data::Report framework consists of three parts:
- The plugins
-
Plugins implement a specific type of report. Standard plugins provided are
Data::Report::Plugin::Text
for textual reports,Data::Report::Plugin::Html
for HTML reports, andData::Report::Plugin::Csv
for CSV (comma-separated) files.Users can, and are encouraged, to develop their own plugins to handle different styles and types of reports.
- The base class
-
The base class
Data::Report::Base
implements the functionality common to all reporters, plus a number of utility functions the plugins can use. - The factory
-
The actual
Data::Report
module is a factory that creates a reporter for a given report type by selecting the appropriate plugin and returning an instance thereof.
METHODS
create
Reporter objects are created using the class method create
. This method takes a hash (or hashref) of arguments to initialise the reporter object.
The actual reporter object is implemented by one of the plugin modules, selected by the type
argument. Standard plugins are provided for text
, HTML
and CSV
report types. The default type is text
.
When looking for a plugin to support report type foo
, the create
method will first try to load a module My::Package::Foo
where My::Package
is the invocant class. If this module cannot be loaded, it will fall back to Data::Report::Plugin::Foo
. Note that, unless subclassed, the current class will be Data::Report
.
All other initialisation arguments correspond to attribute setting methods provided by the plugins. For example, the hypothetical call
my $rpt = Data::Report->create(foo => 1, bar => "Hello!");
is identical to:
my $rpt = Data::Report->create;
$rpt->set_foo(1);
$rpt->set_bar("Hello!");
You can choose any combination at your convenience.
For a description of the possible methods, see Data::Report::API.
AUTHOR
Johan Vromans, <jvromans at squirrel.nl>
BUGS
Disclaimer: This module is derived from actual working code, that I turned into a generic CPAN module. During the process, some features may have become unstable, but that will be cured in time. Also, it is possible that revisions of the API will be necessary when new functionality is added.
Please report any bugs or feature requests to bug-data-report at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data-Report. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Data::Report
perldoc Data::Report::API (user API)
perldoc Data::Report::Base (plugin writer documentation)
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
RT: CPAN's request tracker
Search CPAN
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
Copyright 2006 Squirrel Consultancy, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.