The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Biblio::COUNTER::Processor - superclass for Biblio::COUNTER processors

SYNOPSIS

    # 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.
    

DESCRIPTION

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

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)

COPYRIGHT

Copyright 2008 Paul M. Hoffman.

This is free software, and is made available under the same terms as Perl itself.

SEE ALSO

Biblio::COUNTER

Biblio::COUNTER::Report

Biblio::COUNTER::Report::Processor::Simple