Biblio::COUNTER::Processor - superclass for Biblio::COUNTER processors
# 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.
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.
begin_report
count
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.
$processor = Biblio::COUNTER::Processor->new;
Create a new processor.
$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.
begin_record
cant_fix
$processor->ignore(qw/line input output/);
Specify the events to ignore. The various events are documented in Biblio::COUNTER.
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).
There are no known bugs. Please report bugs to the author via e-mail (see below).
Paul Hoffman (nkuitse AT cpan DOT org)
Copyright 2008 Paul M. Hoffman.
This is free software, and is made available under the same terms as Perl itself.
Biblio::COUNTER
Biblio::COUNTER::Report
Biblio::COUNTER::Report::Processor::Simple
To install Biblio::COUNTER, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Biblio::COUNTER
CPAN shell
perl -MCPAN -e shell install Biblio::COUNTER
For more information on module installation, please visit the detailed CPAN module installation guide.