/[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 1286 by dpavlin, Fri Sep 18 21:30:30 2009 UTC revision 1304 by dpavlin, Sun Sep 20 21:38:15 2009 UTC
# Line 137  This function will read whole database i Line 137  This function will read whole database i
137    
138  By default, C<input_encoding> is assumed to be C<cp852>.  By default, C<input_encoding> is assumed to be C<cp852>.
139    
140  C<offset> is optional parametar to position at some offset before reading from database.  C<offset> is optional parametar to skip records at beginning.
141    
142  C<limit> is optional parametar to read just C<limit> records from database  C<limit> is optional parametar to read just C<limit> records from database
143    
# Line 264  sub open { Line 264  sub open {
264          my $to_rec = $size;          my $to_rec = $size;
265    
266          if (my $s = $self->{offset}) {          if (my $s = $self->{offset}) {
267                  $log->debug("skipping to MFN $s");                  $log->debug("offset $s records");
268                  $from_rec = $s;                  $from_rec = $s + 1;
269          } else {          } else {
270                  $self->{offset} = $from_rec;                  $self->{offset} = $from_rec - 1;
271          }          }
272    
273          if ($self->{limit}) {          if ($self->{limit}) {
# Line 277  sub open { Line 277  sub open {
277          }          }
278    
279          # store size for later          # store size for later
280          $self->{size} = ($to_rec - $from_rec) ? ($to_rec - $from_rec + 1) : 0;          $self->{size} = $to_rec - $from_rec + 1;
281    
282          my $strict_encoding = $arg->{strict_encoding} || $self->{strict_encoding}; ## FIXME should be 1 really          my $strict_encoding = $arg->{strict_encoding} || $self->{strict_encoding}; ## FIXME should be 1 really
283    
# Line 415  sub fetch { Line 415  sub fetch {
415          $log->logconfess("it seems that you didn't load database!") unless ($self->{pos});          $log->logconfess("it seems that you didn't load database!") unless ($self->{pos});
416    
417          if ($self->{pos} == -1) {          if ($self->{pos} == -1) {
418                  $self->{pos} = $self->{offset};                  $self->{pos} = $self->{offset} + 1;
419          } else {          } else {
420                  $self->{pos}++;                  $self->{pos}++;
421          }          }

Legend:
Removed from v.1286  
changed lines
  Added in v.1304

  ViewVC Help
Powered by ViewVC 1.1.26