<<

NAME

Usage - Module for creating simple usage reports

SYNOPSIS

  use Usage;
  my $reporter = new Usage(
    name => 'My Reporter',
    version => 0.1,
    description => 'What my reporter does',
    url => 'http://some.where/'A
  );

DESCRIPTION

This module is a subclass of Inca::Reporter which provides a simple schema for reporting usage data. The reporter will return the following body if the reporter is successful:

    <usage>
      <entry>
        <type>type1</type>
        <name>foo</name>
        <statistics>
          <statistic>
            <name>count</name>
            <value>9</value>
          </statistic>
        </statistics>
      </entry>
      <entry>

      .
      .
      .

    </usage>

CLASS METHODS

new

Class constructor which returns a new Usage object. The constructor accepts the parameters supported by Inca::Reporter.

reportBody

Constructs the body and returns it.

addEntry(%entry)

This method is used to add an entry to the usage report. It takes a hash containing the type and name of the entry as well as a hash of statistics. For example:

  addEntry(
  {
    'type' => 'foo',
    'name' => 'bar',
    'stats' =>
    {
      'count' => 1,
      'blort' => 'baz'
    }
  });

Will create an entry of type 'foo', with a name of 'bar' and two statistics, count with a value of 1 and 'blort' with a value of 'baz'.

fail($error_msg)

This method is used to indicate that the reporter failed. It takes a single arguement which is the error message which will be returned.

success()

This method is called to indicate that the reporter has succeeded.

EXAMPLE

  Coming soon.

AUTHOR

Jon Dugan <jdugan@ncsa.uiuc.edu>

SEE ALSO

Inca::Reporter

<<