50 |
|
|
51 |
Returns handle to database and size in records |
Returns handle to database and size in records |
52 |
|
|
53 |
my ($db,$size) = $open_db( |
my ($db,$size) = $isis->open_db( |
54 |
path => '/path/to/LIBRI' |
path => '/path/to/LIBRI' |
55 |
|
filter => sub { |
56 |
|
my ($l,$field_nr) = @_; |
57 |
|
# do something with $l which is line of input file |
58 |
|
return $l; |
59 |
|
}, |
60 |
} |
} |
61 |
|
|
62 |
|
Options: |
63 |
|
|
64 |
|
=over 4 |
65 |
|
|
66 |
|
=item path |
67 |
|
|
68 |
|
path to CDS/ISIS database |
69 |
|
|
70 |
|
=back |
71 |
|
|
72 |
=cut |
=cut |
73 |
|
|
74 |
sub open_db { |
sub open_db { |
92 |
$isis_db = new Biblio::Isis( |
$isis_db = new Biblio::Isis( |
93 |
isisdb => $arg->{path}, |
isisdb => $arg->{path}, |
94 |
include_deleted => 1, |
include_deleted => 1, |
95 |
hash_filter => sub { |
hash_filter => $arg->{filter} ? sub { return $arg->{filter}->(@_); } : undef, |
|
my $l = shift || return; |
|
|
$l = $self->{iconv}->convert($l) if ($self->{iconv}); |
|
|
return $l; |
|
|
}, |
|
96 |
) or $log->logdie("can't find database $arg->{path}"); |
) or $log->logdie("can't find database $arg->{path}"); |
97 |
|
|
98 |
$db_size = $isis_db->count; |
$db_size = $isis_db->count; |
110 |
|
|
111 |
my $rec = $self->fetch_rec( $db, $mfn ); |
my $rec = $self->fetch_rec( $db, $mfn ); |
112 |
|
|
|
} |
|
|
|
|
113 |
=cut |
=cut |
114 |
|
|
115 |
sub fetch_rec { |
sub fetch_rec { |