Changeset 219

Show
Ignore:
Timestamp:
03/20/06 16:03:51 (6 years ago)
Author:
knok
Message:

Fixed workable.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • namazu-p/trunk/DB_Namazu_Field.pm

    r218 r219  
    22# 
    33 
    4 package DB_Namazu_Fileld; 
     4package DB_Namazu_Field; 
    55use Carp; 
    66use strict; 
    77use IO::File; 
     8use Tie::Array; 
     9our @ISA = ('Tie::Array'); 
     10 
     11sub new { 
     12    my $proto = shift; 
     13    my $class = ref($proto) || $proto; 
     14    my $self = {}; 
     15    bless($self, $class); 
     16    return $self; 
     17} 
    818 
    919sub TIEARRAY { 
    1020    my $class = shift; 
    1121    my $basefile = shift; 
    12     my $self = {}; 
     22    my $self = $class->new(); 
    1323    $self->{basefile} = new IO::File " <$basefile"; 
    1424    $self->{ptrfile} = new IO::File "< ${basefile}.i"; 
     
    2232    my $self = shift; 
    2333    my $index = shift; 
    24     $self->{ptrfile}->seek($index); 
     34    $self->{ptrfile}->seek($index, SEEK_SET); 
    2535    my $ptr; 
    2636    $self->{ptrfile}->read($ptr, 4); 
    2737    $ptr = unpack("N", $ptr); 
    28     $self->{basefile}->seek($ptr); 
     38    $self->{basefile}->seek($ptr, SEEK_SET); 
    2939    return $self->{basefile}->getline; 
    3040}