/[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 307 by dpavlin, Tue Dec 20 00:03:04 2005 UTC revision 619 by dpavlin, Fri Aug 25 12:31:06 2006 UTC
# Line 11  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.03  Version 0.05
15    
16  =cut  =cut
17    
18  our $VERSION = '0.03';  our $VERSION = '0.05';
19    
20    
21  =head1 SYNOPSIS  =head1 SYNOPSIS
# Line 48  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 77  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 97  sub open_db { Line 108  sub open_db {
108    
109  Return record with ID C<$mfn> from database  Return record with ID C<$mfn> from database
110    
111    my $rec = $self->fetch_rec( $db, $mfn );    my $rec = $self->fetch_rec( $db, $mfn, $filter_coderef);
   
 }  
112    
113  =cut  =cut
114    
115  sub fetch_rec {  sub fetch_rec {
116          my $self = shift;          my $self = shift;
117    
118          my ($isis_db, $mfn) = @_;          my ($isis_db, $mfn, $filter_coderef) = @_;
119    
120          my $rec;          my $rec;
121    
# Line 130  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;
# Line 138  sub fetch_rec { Line 147  sub fetch_rec {
147                  }                  }
148    
149          } elsif ($self->{have_biblio_isis}) {          } elsif ($self->{have_biblio_isis}) {
150                  $rec = $isis_db->to_hash($mfn);                  $rec = $isis_db->to_hash({
151                            mfn => $mfn,
152                            include_subfields => 1,
153                            hash_filter => $filter_coderef,
154                    });
155          } else {          } else {
156                  $self->_get_logger()->logdie("hum? implementation missing?");                  $self->_get_logger()->logdie("hum? implementation missing?");
157          }          }

Legend:
Removed from v.307  
changed lines
  Added in v.619

  ViewVC Help
Powered by ViewVC 1.1.26