By default, C<input_encoding> is assumed to be C<cp852>.
-C<offset> is optional parametar to position at some offset before reading from database.
+C<offset> is optional parametar to skip records at beginning.
C<limit> is optional parametar to read just C<limit> records from database
my $to_rec = $size;
if (my $s = $self->{offset}) {
- $log->debug("skipping to MFN $s");
- $from_rec = $s;
+ $log->debug("offset $s records");
+ $from_rec = $s + 1;
} else {
- $self->{offset} = $from_rec;
+ $self->{offset} = $from_rec - 1;
}
if ($self->{limit}) {
}
# store size for later
- $self->{size} = ($to_rec - $from_rec) ? ($to_rec - $from_rec + 1) : 0;
+ $self->{size} = $to_rec - $from_rec + 1;
my $strict_encoding = $arg->{strict_encoding} || $self->{strict_encoding}; ## FIXME should be 1 really
$log->logconfess("it seems that you didn't load database!") unless ($self->{pos});
if ($self->{pos} == -1) {
- $self->{pos} = $self->{offset};
+ $self->{pos} = $self->{offset} + 1;
} else {
$self->{pos}++;
}
diag "offset $s, limit: $l, expected: $e";
ok($s = $input->open( path => "$abs_path/winisis/BIBL", offset => $s, limit => $l, debug => $debug ), "open winisis");
- cmp_ok($s, '==', $size, "db size from open = $size");
+ cmp_ok($s, '==', $size, "db size");
cmp_ok($input->size, '==', $e, "input->size = $e");
}
test_start_limit($input, 1, 3, 3);
test_start_limit($input, $size, 3, 0);
-test_start_limit($input, 3, $size, $size - 2);
-test_start_limit($input, 1, $size + 2, $size);
+test_start_limit($input, 3, $size, $size - 3);
+test_start_limit($input, 1, $size, $size - 1);
ok(my $s = $input->stats, "$module stats");
diag "stats:\n$s" if ($debug);