MARC::Record::Stats - scans one or many MARC::Record and gives a statistics on the tags and subtags
Version 0.0.4
This module provides functionality for marcstats.pl script. Description of the module interface follows.
use MARC::Record::Stats; { my $records = []; # code skipped ... my $stats = MARC::Record::Stats->new; # $records is array of MARC::Record for my $r ( @$records ) { $stats->add_record_to_stats( $r ); } $stats->report( *STDOUT, { dots => 1 } ); } ### ### Some useless features: ### { my $record; my $records = []; # code skipped ... # single record statistics # $record is a MARC::Record my $stats1 = Marc::Record::Stats->new( $record ); # merge $stats1 and statistics for $records # $records is a reference to an array of MARC::Record my $stats2 = Marc::Record::Stats->new( $records, $stats1 ); # ... $stats1->report( *STDOUT ); # $stats2->report( *STDOUT ); }
Builds statistics on $records, appends $stats if given.
Prints out a report on the collected statistics to a filehandle $fh. $config keeps configuretion for the reporter. See MARC::Record::Stats::Report for details
Returns a hashref that contains the statistics:
<stats_hash> = { nrecords => <int>, # the number of records tags => { <tag> => <tagstat>, # for every tag found in records ... } } <tag> = \d{3} # a tag, three digits <tag_stat> = { occurence => <int>, # how many records contain this tag subtags => <subtag_stat>, } <subtag_stat> = { <subtag> => { occurence => <int>, # how many records contain this subtag repeatable => <0|1>, # whether or not is repeatable } } <subtag> = [a-z0-9] # alphanum, subtag
Add $record to statistics.
returns a reference to a hash: { <tag> => <tag_data> } where <tag_data> is a reference to a hash with the keys occurence - how many times the field with the tag <tag> was found in the record, subtags - result of subtag_stats.
returns a reference to a hash { <subtag letter> => <occurence> } where <occurence> is the number of times the subfield with the code <subtag letter> was found in the fied $field.
$field is MARC::Field
Andrei V. Toutoukine, <tut at isuct.ru>
<tut at isuct.ru>
Please report any bugs or feature requests to bug-marc-record-stats at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Marc-Record-Stats. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-marc-record-stats at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Marc::Record::Stats
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Marc-Record-Stats
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Marc-Record-Stats
CPAN Ratings
http://cpanratings.perl.org/d/Marc-Record-Stats
Search CPAN
http://search.cpan.org/dist/Marc-Record-Stats/
Copyright 2011 Andrei V. Toutoukine.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install MARC::Record::Stats, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MARC::Record::Stats
CPAN shell
perl -MCPAN -e shell install MARC::Record::Stats
For more information on module installation, please visit the detailed CPAN module installation guide.