/[webpac2]/trunk/lib/WebPAC/Input/MARC.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/MARC.pm

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

revision 289 by dpavlin, Sun Dec 18 22:16:44 2005 UTC revision 290 by dpavlin, Sun Dec 18 23:10:02 2005 UTC
# Line 51  sub open_db { Line 51  sub open_db {
51          $log->info("opening MARC database '$arg->{path}'");          $log->info("opening MARC database '$arg->{path}'");
52    
53          my $db = new MARC::Fast( marcdb => $arg->{path});          my $db = new MARC::Fast( marcdb => $arg->{path});
54          my $db_size = $db->count;          my $db_size = $db->count - 1;   # FIXME
55    
56            $self->{size} = $db_size;
57    
58          return ($db, $db_size);          return ($db, $db_size);
59  }  }
# Line 71  sub fetch_rec { Line 73  sub fetch_rec {
73    
74          my ($db, $mfn) = @_;          my ($db, $mfn) = @_;
75    
76          return $db->fetch($mfn);          if ($mfn > $self->{size}) {
77                    $self->_get_logger()->warn("seek beyond database size $self->{size} to $mfn");
78            } else {
79                    my $row = $db->fetch($mfn);
80                    $row->{'000'}->[0] = $mfn;
81                    return $row;
82            }
83  }  }
84    
85  =head1 AUTHOR  =head1 AUTHOR

Legend:
Removed from v.289  
changed lines
  Added in v.290

  ViewVC Help
Powered by ViewVC 1.1.26