5 |
|
|
6 |
use WebPAC::Input; |
use WebPAC::Input; |
7 |
use Biblio::Isis 0.23; |
use Biblio::Isis 0.23; |
8 |
|
use base qw/WebPAC::Common/; |
9 |
|
|
10 |
=head1 NAME |
=head1 NAME |
11 |
|
|
13 |
|
|
14 |
=head1 VERSION |
=head1 VERSION |
15 |
|
|
16 |
Version 0.07 |
Version 0.08 |
17 |
|
|
18 |
=cut |
=cut |
19 |
|
|
20 |
our $VERSION = '0.07'; |
our $VERSION = '0.08'; |
21 |
|
|
22 |
|
|
23 |
=head1 SYNOPSIS |
=head1 SYNOPSIS |
25 |
Open CDS/ISIS, WinISIS or IsisMarc database using C<Biblio::Isis> |
Open CDS/ISIS, WinISIS or IsisMarc database using C<Biblio::Isis> |
26 |
and read all records to memory. |
and read all records to memory. |
27 |
|
|
28 |
my $isis = new WebPAC::Input::ISIS(); |
my $isis = new WebPAC::Input::ISIS( |
29 |
$isis->open( path => '/path/to/ISIS/ISIS' ); |
path => '/path/to/ISIS/ISIS', |
30 |
|
); |
31 |
|
|
32 |
=head1 FUNCTIONS |
=head1 FUNCTIONS |
33 |
|
|
34 |
=head2 open_db |
=head2 new |
35 |
|
|
36 |
Returns handle to database and size in records |
Returns new low-level input API object |
37 |
|
|
38 |
my ($db,$size) = $isis->open_db( |
my $isis = new WebPAC::Input::ISIS( |
39 |
path => '/path/to/LIBRI' |
path => '/path/to/LIBRI' |
40 |
filter => sub { |
filter => sub { |
41 |
my ($l,$field_nr) = @_; |
my ($l,$field_nr) = @_; |
56 |
|
|
57 |
=cut |
=cut |
58 |
|
|
59 |
sub open_db { |
sub new { |
60 |
my $self = shift; |
my $class = shift; |
61 |
|
my $self = {@_}; |
62 |
|
bless($self, $class); |
63 |
|
|
64 |
my $arg = {@_}; |
my $arg = {@_}; |
65 |
|
|
74 |
hash_filter => $arg->{filter} ? sub { return $arg->{filter}->(@_); } : undef, |
hash_filter => $arg->{filter} ? sub { return $arg->{filter}->(@_); } : undef, |
75 |
) or $log->logdie("can't find database $arg->{path}"); |
) or $log->logdie("can't find database $arg->{path}"); |
76 |
|
|
|
my $size = $isis_db->count; |
|
|
|
|
77 |
$self->{_isis_db} = $isis_db; |
$self->{_isis_db} = $isis_db; |
78 |
|
|
79 |
return ($isis_db, $size); |
$self ? return $self : return undef; |
80 |
} |
} |
81 |
|
|
82 |
=head2 fetch_rec |
=head2 fetch_rec |
83 |
|
|
84 |
Return record with ID C<$mfn> from database |
Return record with ID C<$mfn> from database |
85 |
|
|
86 |
my $rec = $self->fetch_rec( $mfn, $filter_coderef); |
my $rec = $isis->fetch_rec( $mfn, $filter_coderef); |
87 |
|
|
88 |
=cut |
=cut |
89 |
|
|
112 |
|
|
113 |
Return dump of record ID C<$mfn> from database |
Return dump of record ID C<$mfn> from database |
114 |
|
|
115 |
my $rec = $self->dump_rec( $db, $mfn ); |
my $rec = $isis->dump_rec( $db, $mfn ); |
116 |
|
|
117 |
=cut |
=cut |
118 |
|
|
124 |
return $self->{_isis_db}->to_ascii( $mfn ); |
return $self->{_isis_db}->to_ascii( $mfn ); |
125 |
} |
} |
126 |
|
|
127 |
|
=head2 size |
128 |
|
|
129 |
|
Return number of records in database |
130 |
|
|
131 |
|
my $size = $isis->size; |
132 |
|
|
133 |
|
=cut |
134 |
|
|
135 |
|
sub size { |
136 |
|
my $self = shift; |
137 |
|
return $self->{_isis_db}->count; |
138 |
|
} |
139 |
|
|
140 |
=head1 AUTHOR |
=head1 AUTHOR |
141 |
|
|
142 |
Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >> |
Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >> |