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

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

  ViewVC Help
Powered by ViewVC 1.1.26