Biblio::COUNTER::Processor - superclass for Biblio::COUNTER processors
Contents
Bugs
There are no known bugs. Please report bugs to the author via e-mail (see below).
Copyright
Copyright 2008 Paul M. Hoffman.
This is free software, and is made available under the same terms as Perl itself.
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.
Inheritance
Biblio::COUNTER::Processor is designed to be inheritable; in fact, it doesn't do anything on its own
(unless you count ignoringevents as doing something).
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 ifitisdefined. 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.
Name
Biblio::COUNTER::Processor - superclass for Biblio::COUNTER processors
See Also
Biblio::COUNTER
Biblio::COUNTER::Report
Biblio::COUNTER::Report::Processor::Simple
perl v5.36.0 2023-02-04 Biblio::COUNTER::Processor(3pm)
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.
