--- trunk2/lib/WebPAC.pm 2004/06/16 15:41:16 359 +++ trunk2/lib/WebPAC.pm 2004/06/16 16:50:30 362 @@ -165,10 +165,34 @@ } + $self->{'current_mfn'} = 1; + # store max mfn and return it. return $self->{'max_mfn'} = $maxmfn; } +=head2 fetch_rec + +Fetch next record from database. It will also display progress bar (once +it's implemented, that is). + + my $rec = $webpac->fetch_rec; + +=cut + +sub fetch_rec { + my $self = shift; + + my $mfn = $self->{'current_mfn'}++ || confess "it seems that you didn't load database!"; + + if ($mfn > $self->{'max_mfn'}) { + $self->{'current_mfn'} = $self->{'max_mfn'}; + return; + } + + return $self->{'data'}->{$mfn}; +} + =head2 create_lookup Create lookup from record using lookup definition.