/[webpac2]/trunk/lib/WebPAC/Input/ISIS.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/WebPAC/Input/ISIS.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 285 by dpavlin, Sun Dec 18 21:06:39 2005 UTC revision 597 by dpavlin, Thu Jul 13 11:54:33 2006 UTC
# Line 3  package WebPAC::Input::ISIS; Line 3  package WebPAC::Input::ISIS;
3  use warnings;  use warnings;
4  use strict;  use strict;
5    
 use blib;  
   
6  use WebPAC::Input;  use WebPAC::Input;
 use base qw/WebPAC::Input/;  
7    
8  =head1 NAME  =head1 NAME
9    
# Line 14  WebPAC::Input::ISIS - support for CDS/IS Line 11  WebPAC::Input::ISIS - support for CDS/IS
11    
12  =head1 VERSION  =head1 VERSION
13    
14  Version 0.02  Version 0.03
15    
16  =cut  =cut
17    
18  our $VERSION = '0.02';  our $VERSION = '0.03';
19    
20    
21  =head1 SYNOPSIS  =head1 SYNOPSIS
# Line 40  Autoconfigure this module to use C<Bibli Line 37  Autoconfigure this module to use C<Bibli
37  sub init {  sub init {
38          my $self = shift;          my $self = shift;
39    
40          eval "use Biblio::Isis 0.13;";          eval "use Biblio::Isis;";
41          unless ($@) {          unless ($@) {
42                  $self->{have_biblio_isis} = 1                  $self->{have_biblio_isis} = 1
43          } else {          } else {
# Line 51  sub init { Line 48  sub init {
48    
49  =head2 open_db  =head2 open_db
50    
51  Returns handle to database  Returns handle to database and size in records
52    
53    my $db = $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 {
# Line 80  sub open_db { Line 92  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;
# Line 102  Return record with ID C<$mfn> from datab Line 110  Return record with ID C<$mfn> from datab
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 {
# Line 133  sub fetch_rec { Line 139  sub fetch_rec {
139                                          } else {                                          } else {
140                                                  $val = $l;                                                  $val = $l;
141                                          }                                          }
142                                          push @{$rec->{$k}}, $val;                                          push @{$rec->{"$k"}}, $val;
143                                  }                                  }
144                          } else {                          } else {
145                                  push @{$rec->{'000'}}, $mfn;                                  push @{$rec->{'000'}}, $mfn;

Legend:
Removed from v.285  
changed lines
  Added in v.597

  ViewVC Help
Powered by ViewVC 1.1.26