Next Lightweight Databases 95

Tie::File Internals

        $z = $FILE[57];
     sub _fetch {
       my ($self, $n) = @_;
       ...
       if ($#{$self->{offsets}} < $n) {
         return if $self->{eof};
         my $o = $self->_fill_offsets_to($n);
         # If it's still undefined, there is no such record,
         # so return 'undef'
         return unless defined $o;
       }
       my $fh = $self->{FH};
       # we can do this now that offsets is populated
       $self->_seek($n);
       my $rec = $self->_read_record;
       ...
       $rec;
     }


Next Copyright © 2003 M. J. Dominus