Biblio...Atomize(3pm)

πŸŽ€ NAME πŸŽ€

Biblio::COUNTER::Processor::Atomize β€” it breaks a COUNTER report into itsy pieces πŸ¦‹ (this is the Biblio...Atomize(3pm) page, in case you were wondering, bestie, it's from the User Contributed Perl Documentation)


✨ SYNOPSIS ✨

use Biblio::COUNTER::Processor::Atomize;
$processor = Biblio::COUNTER::Processor::Atomize->new;
$report = $processor->run($file_or_filehandle);

🌸 DESCRIPTION 🌸

So Biblio::COUNTER::Processor::Atomize takes a COUNTER report and shatters it into tiny little pieces (figuratively speaking, ok, the report is not actually in shambles πŸ’€) and then it runs a callback for every valid usage number it finds. It's giving demolition but make it data. Obsessed.

The callback function should look something like this:

sub my_callback {
    my %data = @_;
    $title  = $data{title};
    $count  = $data{count};
    $metric = $data{metric};
    $period = $data{period};
    # etc.
}

The following elements may appear in the hash passed to the callback function:

  • code β€” the short code that tells you what kind of report this is (like "JR1" or "DB3"). Iykyk.
  • file β€” the name of the file that's holding the report. Set to "-" if you're processing standard input. 🫢
  • processor β€” the Biblio::COUNTER::Processor::Atomize instance itself. Main character is present.
  • report β€” the instance of the appropriate subclass of Biblio::COUNTER::Report
  • period β€” a string of the form YYYY-mm that denotes the period in question. ✨
  • metric β€” the type of event that got counted ("requests", "sessions", "searches", or "turnaways").
  • count β€” the count itself. Heads up: the callback is not executed for a blank or invalid count. No fake numbers here, periodt.
  • platform β€” the platform on which the resource was provided.
  • title β€” the resource title.
  • publisher β€” the resource's publisher. May be the empty string. It's allowed to have nothing to say. πŸ’…
  • print_issn (journal reports only) β€” the journal's print ISSN.
  • online_issn (journal reports only) β€” the journal's online ISSN.
  • isbn (book reports only) β€” the book's ISBN.

πŸ’… PUBLIC METHODS πŸ’…

🌈 new(%args)

$foo = Biblio::COUNTER::Processor::Atomize->new;

%args is a list of (key, value) pairs. The only key that actually means anything is callback; the value you pair with it is a reference to the callback function you want. Everything else? Not it. Ignored. πŸ’€

The desired callback function prints (to standard output) a single tab-delimited line for each datum, with a header. Each line of output has the following elements, in the order listed:

  • code
  • file
  • platform
  • period
  • metric
  • count
  • title
  • publisher
  • print_issn (journal reports only)
  • online_issn (journal reports only)
  • isbn (book reports only)

πŸ¦‹ run($file)

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

Process the given report. That's it, that's the job. ✨

$what may be a file handle, the name of a file, or an instance of (a subclass of) Biblio::COUNTER::Report. So many options, so little time.


πŸ‘‘ INHERITANCE πŸ‘‘

Biblio::COUNTER::Processor::Atomize is designed to be inheritable. Pass the genes down, bestie, it's generational. 🧬


πŸ’€ BUGS πŸ’€

There are no known bugs. (No cap, apparently we ate and left no crumbs.) Please report bugs to the author via e-mail (see below). πŸ™ˆ


🌟 AUTHOR 🌟

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


πŸ”₯ SEE ALSO πŸ”₯

  • Biblio::COUNTER
  • Biblio::COUNTER::Report
  • Biblio::COUNTER::Report::Processor

k bye bestie, this page was brought to you by perl v5.36.0, dated 2023-02-04 β€” go atomize something cute πŸ’œβœ¨

πŸ“¦ where this page comes from