logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Biblio::COUNTER::Processor::Atomize - break a COUNTER report into itsy pieces

Author

       Paul Hoffman (nkuitse AT cpan DOT org)

Bugs

       There are no known bugs.  Please report bugs to the author via e-mail (see below).

Description

Biblio::COUNTER::Processor::Atomize breaks a COUNTER report into tiny pieces (figuratively speaking) and
       executes a callback for each valid usage number it finds.

       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 indicates the type of the report (e.g., "JR1" or "DB3").

       file
           The name of the file containing the report.  Set to "-" if processing standard input.

       processor
           The Biblio::COUNTER::Processor::Atomize instance.

       report
           The instance of the appropriate subclass of Biblio::COUNTER::Report

       period
           A string of the form YYYY-mm denoting the period in question.

       metric
           The type of event counted ("requests", "sessions", "searches", or "turnaways").

       count
           The count itself.  The callback is not executed for a blank or invalid count.

       platform
           The platform on which the resource was provided.

       title
           The resource title.

       publisher
           The resource's publisher.  May be the empty string.

       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.

Inheritance

Biblio::COUNTER::Processor::Atomize is designed to be inheritable.

Name

       Biblio::COUNTER::Processor::Atomize - break a COUNTER report into itsy pieces

Public Methods

new(%args)
               $foo = Biblio::COUNTER::Processor::Atomize->new;

           %args  is  a  list  of  (key,  value) pairs.  The only key that means anything is callback; the value
           associated with it is a reference to the desired callback function.

           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:

           codefileplatformperiodmetriccounttitlepublisherprint_issn (journal reports only)
           online_issn (journal reports only)
           isbn (book reports only)
       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.

See Also

       Biblio::COUNTER

       Biblio::COUNTER::Report

       Biblio::COUNTER::Report::Processor

perl v5.36.0                                       2023-02-04              Biblio::COUNTE...cessor::Atomize(3pm)

Synopsis

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

See Also