Biblio...cessor(3pm)
π Biblio::COUNTER::Processor β the superclass era π
okay bestie, sit down, hydrate, and let me tell you about Biblio::COUNTER::Processor, a Perl module from the User Contributed Perl Documentation collection π«Ά
β¨ NAME β¨
Biblio::COUNTER::Processor β it's the superclass for Biblio::COUNTER processors. literally the blueprint. the mother of all processors. the blueprint that does nothing on purpose π
πΈ SYNOPSIS πΈ
so here's how you'd actually use it:
# Use
use Biblio::COUNTER::Processor;
$processor = Biblio::COUNTER::Processor->new;
$processor->ignore(@events);
$report = $processor->run;
and here's how you'd subclass it, which is kind of the whole point:
# 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.
look at those handler signatures. iconic. π
π¦ DESCRIPTION π¦
Biblio::COUNTER::Processor is an inheritable class, and what it gives you is an intermediate interface to Biblio::COUNTER.
here's the tea though: when you use it on its own, it does nothing. absolutely nothing. zero. it's giving "I'm just here to be a parent class." π subclasses are the ones who have to define handlers for the various events β stuff like begin_report or count β that get triggered while a report is being processed.
Event-handling methods, if they're defined, get invoked with the exact same arguments that are documented in Biblio::COUNTER, with one lil twist: an additional argument gets prepended β that's the instance of the Biblio::COUNTER::Processor subclass itself. so your $self comes first, always, no cap.
and if you want a class that actually does something when events fire? go look at Biblio::COUNTER::Processor::Simple. that one's the overachiever. π
π METHODS π
new
$processor = Biblio::COUNTER::Processor->new;
creates a brand new processor. that's it. that's the whole job. slay. β¨
run($file)
$report = $processor->run($what);
processes the given report.
now, $what is flexible like that β it can be any of these:
- a file handle
- the name of a file
- an instance of (a subclass of)
Biblio::COUNTER::Report
a Biblio::COUNTER::Report object gets instantiated and its process method gets invoked. and every single time an event is triggered, a method with the event's name β like begin_record or cant_fix β gets invoked if it is defined.
and since this class doesn't define any of those methods, the default behavior when an event is triggered is... to do nothing. π literally the "I'm not gonna say anything" meme.
ignore(@events)
$processor->ignore(qw/line input output/);
tells the processor which events to ignore. the various events are all documented in Biblio::COUNTER, so go read that if you need the full list. bestie behavior honestly. π
π INHERITANCE π
Biblio::COUNTER::Processor is designed to be inheritable. in fact β and I cannot stress this enough β it doesn't do anything on its own.
unless, of course, you count ignoring events as doing something. which... fair. that's a whole personality trait honestly. π
π BUGS π
there are no known bugs. none. zero. the vibe check passed. β¨
if you do find one though, please report bugs to the author via e-mail (see below, bestie, the info's right there). π«Ά
π 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::COUNTERBiblio::COUNTER::ReportBiblio::COUNTER::Report::Processor::Simple
and that's the whole page, bestie!! π¦ this was perl v5.36.0, dated 2023-02-04, brought to you by the fine folks behind the User Contributed Perl Documentation. now go forth and subclass responsibly. periodt. π β¨
π¦ where this page comes from
- debian bookworm: libbiblio-counter-perl 0.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libbiblio-counter-perl 0.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libbiblio-counter-perl 0.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libbiblio-counter-perl 0.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libbiblio-counter-perl 0.11-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms