DESCRIPTION

Metabase is a system for associating metadata with CPAN distributions. The metabase can be used to store test reports, reviews, coverage analysis reports, reports on static analysis of coding style, or anything else for which datatypes are constructed.

Metabase::Report is a base class for collections of Metabase::Fact objects that can be sent to or retrieved from a Metabase system.

Metabase::Report is itself a subclass of Metabase::Fact and offers the same API, except as described below.

SUBCLASSING

A subclass of Metabase::Report only requires one method, "report_spec".

ATTRIBUTES

content

The content attribute of a Report must be a reference to an array of Metabase::Fact subclass objects.

METHODS

In addition to the standard new constructor, the following open, add and close methods may be used to construct a report piecemeal, instead.

open

Constructs a new, empty report. The 'id' attribute is required. The 'refers_to' attribute is optional. The 'content' attribute may be provided, but see add below. No other attributes may be provided to new.

add

$report->add( 'Fact::Subclass' => $content );

Using the 'id' attribute of the report, this method constructs a new Fact from a class and a content argument. The resulting Fact is appended to the Report's content array.

close

$report->close;

This method validates the report based on all Facts added so far.

facts

This method returns a list of all the facts in the report. In scalar context, it returns the number of facts in the report.

CLASS METHODS

fact_classes

load_fact_classes

Loads each class listed in the report spec.

ABSTRACT METHODS

Methods marked as 'required' must be implemented by a report subclass. (The version in Metabase::Report will die with an error if called.)

report_spec

required

$spec = Report::Subclass->report_spec;

The report_spec method MUST return a hash reference that defines how many Facts of which types must be in the report for it to be considered valid. Keys MUST be class names. Values MUST be non-negative integers that indicate the number of Facts of that type that must be present for a report to be valid, optionally followed by a '+' character to indicate that the report may contain more than the given number.