X-Git-Url: http://git.rot13.org/?p=webpac2;a=blobdiff_plain;f=lib%2FWebPAC%2FInput%2FMARC.pm;h=60023200e4fc897e0caa1f8aed46e415dbc3da1f;hp=c5f7b3028eb05bd30b8c395b1428b49d9bc8c7d1;hb=0f28ff5a71e21a2a57a1e448123a27eaaabd6faa;hpb=7231c84972bb18eef741860717bf0320ea567610 diff --git a/lib/WebPAC/Input/MARC.pm b/lib/WebPAC/Input/MARC.pm index c5f7b30..6002320 100644 --- a/lib/WebPAC/Input/MARC.pm +++ b/lib/WebPAC/Input/MARC.pm @@ -3,7 +3,7 @@ package WebPAC::Input::MARC; use warnings; use strict; -use MARC::Fast; +use MARC::Fast 0.12; use base qw/WebPAC::Common/; use Carp qw/confess/; @@ -56,10 +56,6 @@ sub new { my $db = new MARC::Fast( marcdb => $arg->{path}, - hash_filter => sub { - my ( $l, $nr ) = @_; - Encode::decode( 'utf-8', $l ); - }, ); my $db_size = $db->count - 1; # FIXME @@ -80,13 +76,13 @@ Return record with ID C<$mfn> from database sub fetch_rec { my $self = shift; - my $mfn = shift; + my ($mfn, $filter_coderef) = @_; if ($mfn > $self->{_marc_size}) { $self->_get_logger()->warn("seek beyond database size $self->{_marc_size} to $mfn"); } else { my $marc = $self->{_marc_db} || confess "no _marc_db?"; - my $row = $marc->to_hash($mfn, include_subfields => 1); + my $row = $marc->to_hash($mfn, include_subfields => 1, hash_filter => $filter_coderef); push @{$row->{'000'}}, $mfn; push @{$row->{'leader'}}, $marc->last_leader; return $row;