/[webpac]/trunk2/lib/WebPAC.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 /trunk2/lib/WebPAC.pm

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

revision 704 by dpavlin, Fri Dec 31 03:34:33 2004 UTC revision 705 by dpavlin, Wed Jul 13 22:34:52 2005 UTC
# Line 13  use Time::HiRes qw(time); Line 13  use Time::HiRes qw(time);
13    
14  use Data::Dumper;  use Data::Dumper;
15    
16    my ($have_biblio_isis, $have_openisis) = (0,0);
17    
18    eval "use Biblio::Isis 0.13;";
19    unless ($@) {
20            $have_biblio_isis = 1
21    } else {
22            eval "use OpenIsis;";
23            $have_openisis = 1 unless ($@);
24    }
25    
26  #my $LOOKUP_REGEX = '\[[^\[\]]+\]';  #my $LOOKUP_REGEX = '\[[^\[\]]+\]';
27  #my $LOOKUP_REGEX_SAVE = '\[([^\[\]]+)\]';  #my $LOOKUP_REGEX_SAVE = '\[([^\[\]]+)\]';
28  my $LOOKUP_REGEX = 'lookup{[^\{\}]+}';  my $LOOKUP_REGEX = 'lookup{[^\{\}]+}';
# Line 207  sub open_isis { Line 217  sub open_isis {
217          $log->info("reading ISIS database '",$arg->{'filename'},"'");          $log->info("reading ISIS database '",$arg->{'filename'},"'");
218          $log->debug("isis code page: $code_page");          $log->debug("isis code page: $code_page");
219    
         my $use_openisis = 1;  
   
         eval { use IsisDB 0.06; };  
         $use_openisis = 0 unless ($@);  
   
220          my ($isis_db,$maxmfn);          my ($isis_db,$maxmfn);
221    
222          if ($use_openisis) {          if ($have_openisis) {
223                  use OpenIsis;                  $log->debug("using OpenIsis perl bindings");
224                  $isis_db = OpenIsis::open($arg->{'filename'});                  $isis_db = OpenIsis::open($arg->{'filename'});
225                  $maxmfn = OpenIsis::maxRowid( $isis_db ) || 1;                  $maxmfn = OpenIsis::maxRowid( $isis_db ) || 1;
226          } else {          } elsif ($have_biblio_isis) {
227                  $isis_db = new IsisDB(                  $log->debug("using Biblio::Isis");
228                    use Biblio::Isis;
229                    $isis_db = new Biblio::Isis(
230                          isisdb => $arg->{'filename'},                          isisdb => $arg->{'filename'},
231                          include_deleted => 1,                          include_deleted => 1,
232                          hash_filter => sub {                          hash_filter => sub {
# Line 229  sub open_isis { Line 236  sub open_isis {
236                          },                          },
237                  );                  );
238                  $maxmfn = $isis_db->{'maxmfn'};                  $maxmfn = $isis_db->{'maxmfn'};
239            } else {
240                    $log->logdie("Can't find supported ISIS library for perl. I suggent that you install Bilbio::Isis from CPAN.");
241          }          }
242    
243    
# Line 243  sub open_isis { Line 252  sub open_isis {
252    
253          $maxmfn = $startmfn + $self->{limit_mfn} if ($self->{limit_mfn});          $maxmfn = $startmfn + $self->{limit_mfn} if ($self->{limit_mfn});
254    
255          $log->info("processing ",($maxmfn-$startmfn)." records using ",( $use_openisis ? 'OpenIsis' : 'IsisDB'));          $log->info("processing ",($maxmfn-$startmfn)." records using ",( $have_openisis ? 'OpenIsis' : 'Biblio::Isis'));
256    
257    
258          # read database          # read database
# Line 254  sub open_isis { Line 263  sub open_isis {
263    
264                  my $rec;                  my $rec;
265    
266                  if ($use_openisis) {                  if ($have_openisis) {
267    
268                          # read record using OpenIsis                          # read record using OpenIsis
269                          my $row = OpenIsis::read( $isis_db, $mfn );                          my $row = OpenIsis::read( $isis_db, $mfn );
# Line 280  sub open_isis { Line 289  sub open_isis {
289                                  }                                  }
290                          }                          }
291    
292                  } else {                  } elsif ($have_biblio_isis) {
293                          $rec = $isis_db->to_hash($mfn);                          $rec = $isis_db->to_hash($mfn);
294                    } else {
295                            $log->logdie("hum? implementation missing?");
296                  }                  }
297    
298                  $log->confess("record $mfn empty?") unless ($rec);                  $log->confess("record $mfn empty?") unless ($rec);

Legend:
Removed from v.704  
changed lines
  Added in v.705

  ViewVC Help
Powered by ViewVC 1.1.26