The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Marc::Record::Stats - scans one or many MARC::Record and gives a statistics on the tags and subtags

VERSION

Version 0.0.1

SYNOPSIS

    use Marc::Record::Stats;
    use Data::Dumper;
	...
	# single record statistics
	# $record is a MARC::Record
    my $stats1 = Marc::Record::Stats->new( $record );
    
    # many records statistics
    # $records is a reference to an array of MARC::Record
    my $stats2 = Marc::Record::Stats->new( $records, $stats1 );
    ...
    Data::Dumper->Dump([$stats1, $stats2],['stats1', 'stats2']);

METHODS

new $records [, $stats]

Builds statistics on $records, appends $stats if given.

$records A MARC::Record or a reference to an array of MARC::Record
$stats Marc::Record::Stats object that contains accumulated statistics.

get_stats_hash

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_stats $record

Add record to statistics

$record MARC::Record

subtag_stats $field

returns <subtag_stat>

$field MARC::Field

AUTHOR

Andrei V. Toutoukine, <tut at isuct.ru>

BUGS

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.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Marc::Record::Stats

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

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.