1 package WebPAC::Input::ISIS;
10 WebPAC::Input::ISIS - support for CDS/ISIS database files
18 our $VERSION = '0.03';
23 Open CDS/ISIS, WinISIS or IsisMarc database using C<Biblio::Isis> or
24 C<OpenIsis> module and read all records to memory.
26 my $isis = new WebPAC::Input::ISIS();
27 $isis->open( path => '/path/to/ISIS/ISIS' );
33 Autoconfigure this module to use C<Biblio::Isis> or C<OpenIsis>.
40 eval "use Biblio::Isis;";
42 $self->{have_biblio_isis} = 1
45 $self->{have_openisis} = 1 unless ($@);
51 Returns handle to database
54 path => '/path/to/LIBRI'
64 my $log = $self->_get_logger();
66 $log->info("opening ISIS database '$arg->{path}'");
68 my ($isis_db,$db_size);
70 if ($self->{have_openisis}) {
71 $log->debug("using OpenIsis perl bindings");
72 $isis_db = OpenIsis::open($arg->{path});
73 $db_size = OpenIsis::maxRowid( $isis_db ) || 1;
74 } elsif ($self->{have_biblio_isis}) {
75 $log->debug("using Biblio::Isis");
77 $isis_db = new Biblio::Isis(
78 isisdb => $arg->{path},
81 my $l = shift || return;
82 $l = $self->{iconv}->convert($l) if ($self->{iconv});
85 ) or $log->logdie("can't find database $arg->{path}");
87 $db_size = $isis_db->count;
90 $log->logdie("Can't find supported ISIS library for perl. I suggent that you install Bilbio::Isis from CPAN.");
93 return ($isis_db, $db_size);
98 Return record with ID C<$mfn> from database
100 my $rec = $self->fetch_rec( $db, $mfn );
109 my ($isis_db, $mfn) = @_;
113 if ($self->{have_openisis}) {
115 # read record using OpenIsis
116 my $row = OpenIsis::read( $isis_db, $mfn );
118 # convert record to hash
119 foreach my $k (keys %{$row}) {
121 foreach my $l (@{$row->{$k}}) {
122 $l = $self->{iconv}->convert($l) if ($self->{iconv});
126 foreach my $t (split(/\^/,$l)) {
128 $val->{substr($t,0,1)} = substr($t,1);
133 push @{$rec->{$k}}, $val;
136 push @{$rec->{'000'}}, $mfn;
140 } elsif ($self->{have_biblio_isis}) {
141 $rec = $isis_db->to_hash($mfn);
143 $self->_get_logger()->logdie("hum? implementation missing?");
151 Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >>
153 =head1 COPYRIGHT & LICENSE
155 Copyright 2005 Dobrica Pavlinusic, All Rights Reserved.
157 This program is free software; you can redistribute it and/or modify it
158 under the same terms as Perl itself.
162 1; # End of WebPAC::Input::ISIS