Biblio::COUNTER::Processor(3pm)

Biblio::COUNTER::Processor3pm

Superclass for biblio::counter processors

Usage

    # Use
    use Biblio::COUNTER::Processor;
    $processor = Biblio::COUNTER::Processor->new;
    $processor->ignore(@events);
    $report = $processor->run;
    # Subclass
    use MyProcessor;
    @MyProcessor::ISA = qw(Biblio::COUNTER::Processor);
    # Event handlers
    sub begin_report {
        my ($self, $report) = @_;
        # etc.
    }
    sub count {
        my ($self, $report, $scope, $field, $period, $val) = @_;
        # etc.
    }
    # etc.

Overview

Biblio::COUNTER::Processor is an inheritable class that provides an intermediate interface to Biblio::COUNTER. When used on its own, it does nothing; subclasses must define handlers for the various events (e.g., "begin_report" or "count") that are triggered as a report is processed.

Event-handling methods (if defined) are invoked with the arguments documented in Biblio::COUNTER, except that an additional argument (the instance of the Biblio::COUNTER::Processor subclass) is prepended.

For a class that actually does something when events are triggered, see Biblio::COUNTER::Processor::Simple.

Methods

new
    $processor = Biblio::COUNTER::Processor->new;

Create a new processor.

run($file)
    $report = $processor->run($what);

Process the given report.

$what may be a file handle, the name of a file, or an instance of (a subclass of) Biblio::COUNTER::Report.

A Biblio::COUNTER::Report object will be instantiated and its process method invoked; each time an event is triggered, a method with the event's name (e.g., "begin_record" or "cant_fix") is invoked if it is defined. Since this class doesn't define any such methods, the default behavior when an event is triggered is to do nothing.

ignore(@events)
    $processor->ignore(qw/line input output/);

Specify the events to ignore. The various events are documented in Biblio::COUNTER.

Inheritance

Biblio::COUNTER::Processor is designed to be inheritable; in fact, it doesn't do anything on its own (unless you count ignoring events as doing something).

Releases

Unchanged in 2 releases since Debian 12 (Bookworm).

  1. 12–13

Bugs

There are no known bugs. Please report bugs to the author via e-mail (see below).

Author

Paul Hoffman (nkuitse AT cpan DOT org)

From libbiblio-counter-perl 0.11-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.