.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "MARC::Fast 3pm" .TH MARC::Fast 3pm "2023-01-29" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" MARC::Fast \- Very fast implementation of MARC database reader .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use MARC::Fast; \& \& my $marc = new MARC::Fast( \& marcdb => \*(Aqunimarc.iso\*(Aq, \& ); \& \& foreach my $mfn ( 1 .. $marc\->count ) { \& print $marc\->to_ascii( $mfn ); \& } .Ve .PP For longer example with command line options look at \*(L"dump_fastmarc.pl\*(R" in scripts .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is very fast alternative to \f(CW\*(C`MARC\*(C'\fR and \f(CW\*(C`MARC::Record\*(C'\fR modules. .PP It's is also very subtable for random access to \s-1MARC\s0 records (as opposed to sequential one). .SH "METHODS" .IX Header "METHODS" .SS "new" .IX Subsection "new" Read \s-1MARC\s0 database .PP .Vb 11 \& my $marc = new MARC::Fast( \& marcdb => \*(Aqunimarc.iso\*(Aq, \& quiet => 0, \& debug => 0, \& assert => 0, \& hash_filter => sub { \& my ($t, $record_number) = @_; \& $t =~ s/foo/bar/; \& return $t; \& }, \& ); .Ve .SS "count" .IX Subsection "count" Return number of records in database .PP .Vb 1 \& print $marc\->count; .Ve .SS "fetch" .IX Subsection "fetch" Fetch record from database .PP .Vb 1 \& my $hash = $marc\->fetch(42); .Ve .PP First record number is \f(CW1\fR .SS "last_leader" .IX Subsection "last_leader" Returns leader of last record fetched .PP .Vb 1 \& print $marc\->last_leader; .Ve .PP Added in version 0.08 of this module, so if you need it use: .PP .Vb 1 \& use MARC::Fast 0.08; .Ve .PP to be sure that it's supported. .SS "to_hash" .IX Subsection "to_hash" Read record with specified \s-1MFN\s0 and convert it to hash .PP .Vb 3 \& my $hash = $marc\->to_hash( $mfn, include_subfields => 1, \& hash_filter => sub { my ($l,$tag) = @_; return $l; } \& ); .Ve .PP It has ability to convert characters (using \f(CW\*(C`hash_filter\*(C'\fR) from \s-1MARC\s0 database before creating structures enabling character re-mapping or quick fix-up of data. If you specified \f(CW\*(C`hash_filter\*(C'\fR both in \f(CW\*(C`new\*(C'\fR and \f(CW\*(C`to_hash\*(C'\fR only the one from \f(CW\*(C`to_hash\*(C'\fR will be used. .PP This function returns hash which is like this: .PP .Vb 9 \& \*(Aq200\*(Aq => [ \& { \& \*(Aqi1\*(Aq => \*(Aq1\*(Aq, \& \*(Aqi2\*(Aq => \*(Aq \*(Aq \& \*(Aqa\*(Aq => \*(AqGoa\*(Aq, \& \*(Aqf\*(Aq => \*(AqValdo D\e\*(AqArienzo\*(Aq, \& \*(Aqe\*(Aq => \*(Aqtipografie e tipografi nel XVI secolo\*(Aq, \& } \& ], .Ve .PP This method will also create additional field \f(CW000\fR with \s-1MFN.\s0 .SS "to_ascii" .IX Subsection "to_ascii" .Vb 1 \& print $marc\->to_ascii( 42 ); .Ve .SH "UTF\-8 ENCODING" .IX Header "UTF-8 ENCODING" This module does nothing with encoding. But, since \s-1MARC\s0 format is byte oriented even when using \s-1UTF\-8\s0 which has variable number of bytes for each character, file is opened in binary mode. .PP As a result, all scalars recturned to perl don't have utf\-8 flag. Solution is to use \f(CW\*(C`hash_filter\*(C'\fR and Encode to decode utf\-8 encoding like this: .PP .Vb 1 \& use Encode; \& \& my $marc = new MARC::Fast( \& marcdb => \*(Aqutf8.marc\*(Aq, \& hash_filter => sub { \& Encode::decode( \*(Aqutf\-8\*(Aq, $_[0] ); \& }, \& ); .Ve .PP This will affect \f(CW\*(C`to_hash\*(C'\fR, but \f(CW\*(C`fetch\*(C'\fR will still return binary representation since it doesn't support \f(CW\*(C`hash_filter\*(C'\fR. .SH "AUTHOR" .IX Header "AUTHOR" .Vb 4 \& Dobrica Pavlinusic \& CPAN ID: DPAVLIN \& dpavlin@rot13.org \& http://www.rot13.org/~dpavlin/ .Ve .SH "COPYRIGHT" .IX Header "COPYRIGHT" This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP The full text of the license can be found in the \&\s-1LICENSE\s0 file included with this module. .SH "SEE ALSO" .IX Header "SEE ALSO" Biblio::Isis, \fBperl\fR\|(1).