/[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 298 by dpavlin, Mon Dec 19 19:55:21 2005 UTC
# Line 5  use strict; Line 5  use strict;
5    
6  use blib;  use blib;
7    
 use WebPAC::Common;  
8  use MARC::Fast;  use MARC::Fast;
9    
10  =head1 NAME  =head1 NAME
# Line 14  WebPAC::Input::MARC - support for MARC d Line 13  WebPAC::Input::MARC - support for MARC d
13    
14  =head1 VERSION  =head1 VERSION
15    
16  Version 0.01  Version 0.02
17    
18  =cut  =cut
19    
20  our $VERSION = '0.01';  our $VERSION = '0.02';
21    
22    
23  =head1 SYNOPSIS  =head1 SYNOPSIS
# Line 51  sub open_db { Line 50  sub open_db {
50          $log->info("opening MARC database '$arg->{path}'");          $log->info("opening MARC database '$arg->{path}'");
51    
52          my $db = new MARC::Fast( marcdb => $arg->{path});          my $db = new MARC::Fast( marcdb => $arg->{path});
53          my $db_size = $db->count;          my $db_size = $db->count - 1;   # FIXME
54    
55            $self->{size} = $db_size;
56    
57          return ($db, $db_size);          return ($db, $db_size);
58  }  }
# Line 71  sub fetch_rec { Line 72  sub fetch_rec {
72    
73          my ($db, $mfn) = @_;          my ($db, $mfn) = @_;
74    
75          return $db->fetch($mfn);          if ($mfn > $self->{size}) {
76                    $self->_get_logger()->warn("seek beyond database size $self->{size} to $mfn");
77            } else {
78                    my $row = $db->fetch($mfn);
79                    push @{$row->{'000'}}, $mfn;
80                    return $row;
81            }
82  }  }
83    
84  =head1 AUTHOR  =head1 AUTHOR

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

  ViewVC Help
Powered by ViewVC 1.1.26