3 |
use warnings; |
use warnings; |
4 |
use strict; |
use strict; |
5 |
|
|
6 |
use MARC::Fast 0.03; |
use MARC::Fast; |
7 |
use base qw/WebPAC::Common/; |
use base qw/WebPAC::Common/; |
8 |
use Carp qw/confess/; |
use Carp qw/confess/; |
9 |
|
|
37 |
|
|
38 |
my $marc = new WebPAC::Input::MARC( |
my $marc = new WebPAC::Input::MARC( |
39 |
path => '/path/to/marc.iso', |
path => '/path/to/marc.iso', |
|
filter => \&code_ref, |
|
40 |
} |
} |
41 |
|
|
42 |
=cut |
=cut |
52 |
|
|
53 |
$log->info("opening MARC database '$arg->{path}'"); |
$log->info("opening MARC database '$arg->{path}'"); |
54 |
|
|
55 |
|
die "no filter support any more!" if $arg->{filter}; |
56 |
|
|
57 |
my $db = new MARC::Fast( |
my $db = new MARC::Fast( |
58 |
marcdb => $arg->{path}, |
marcdb => $arg->{path}, |
59 |
hash_filter => $arg->{filter}, |
hash_filter => sub { |
60 |
|
my ( $l, $nr ) = @_; |
61 |
|
Encode::decode( 'utf-8', $l ); |
62 |
|
}, |
63 |
); |
); |
64 |
my $db_size = $db->count - 1; # FIXME |
my $db_size = $db->count - 1; # FIXME |
65 |
|
|
86 |
$self->_get_logger()->warn("seek beyond database size $self->{_marc_size} to $mfn"); |
$self->_get_logger()->warn("seek beyond database size $self->{_marc_size} to $mfn"); |
87 |
} else { |
} else { |
88 |
my $marc = $self->{_marc_db} || confess "no _marc_db?"; |
my $marc = $self->{_marc_db} || confess "no _marc_db?"; |
89 |
my $row = $marc->to_hash($mfn); |
my $row = $marc->to_hash($mfn, include_subfields => 1); |
90 |
push @{$row->{'000'}}, $mfn; |
push @{$row->{'000'}}, $mfn; |
91 |
push @{$row->{'leader'}}, $marc->last_leader; |
push @{$row->{'leader'}}, $marc->last_leader; |
92 |
return $row; |
return $row; |