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

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

revision 338 by dpavlin, Sat Dec 31 16:50:06 2005 UTC revision 339 by dpavlin, Sat Dec 31 16:50:11 2005 UTC
# Line 197  sub open { Line 197  sub open {
197                  return;                  return;
198          }          }
199    
200          my $offset = 1;          my $from_rec = 1;
201          my $limit = $size;          my $to_rec = $size;
202    
203          if (my $s = $self->{offset}) {          if (my $s = $self->{offset}) {
204                  $log->info("skipping to MFN $s");                  $log->info("skipping to MFN $s");
205                  $offset = $s;                  $from_rec = $s;
206          } else {          } else {
207                  $self->{offset} = $offset;                  $self->{offset} = $from_rec;
208          }          }
209    
210          if ($self->{limit}) {          if ($self->{limit}) {
211                  $log->debug("limiting to ",$self->{limit}," records");                  $log->debug("limiting to ",$self->{limit}," records");
212                  $limit = $offset + $self->{limit} - 1;                  $to_rec = $from_rec + $self->{limit} - 1;
213                  $limit = $size if ($limit > $size);                  $to_rec = $size if ($to_rec > $size);
214          }          }
215    
216          # store size for later          # store size for later
217          $self->{size} = ($limit - $offset) ? ($limit - $offset + 1) : 0;          $self->{size} = ($to_rec - $from_rec) ? ($to_rec - $from_rec + 1) : 0;
218    
219          $log->info("processing $self->{size}/$size records [$offset-$limit] convert $code_page -> $self->{code_page}");          $log->info("processing $self->{size}/$size records [$from_rec-$to_rec] convert $code_page -> $self->{code_page}");
220    
221          # read database          # read database
222          for (my $pos = $offset; $pos <= $limit; $pos++) {          for (my $pos = $from_rec; $pos <= $to_rec; $pos++) {
223    
224                  $log->debug("position: $pos\n");                  $log->debug("position: $pos\n");
225    
# Line 242  sub open { Line 242  sub open {
242                  # create lookup                  # create lookup
243                  $self->{'lookup'}->add( $rec ) if ($rec && $self->{'lookup'});                  $self->{'lookup'}->add( $rec ) if ($rec && $self->{'lookup'});
244    
245                  $self->progress_bar($pos,$limit);                  $self->progress_bar($pos,$to_rec);
246    
247          }          }
248    
# Line 250  sub open { Line 250  sub open {
250          $self->{last_pcnt} = 0;          $self->{last_pcnt} = 0;
251    
252          # store max mfn and return it.          # store max mfn and return it.
253          $self->{max_pos} = $limit;          $self->{max_pos} = $to_rec;
254          $log->debug("max_pos: $limit");          $log->debug("max_pos: $to_rec");
255    
256          return $size;          return $size;
257  }  }

Legend:
Removed from v.338  
changed lines
  Added in v.339

  ViewVC Help
Powered by ViewVC 1.1.26