From: Dobrica Pavlinusic Date: Sat, 23 Oct 2010 16:57:49 +0000 (+0200) Subject: stop at last record X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=1a64df1b039682d68be71ad4e147f3cf4bcacf84;p=Biblio-Z3950.git stop at last record --- diff --git a/Aleph.pm b/Aleph.pm index 474cd95..3ad6287 100644 --- a/Aleph.pm +++ b/Aleph.pm @@ -115,7 +115,7 @@ diag "in MARC format"; $mech->follow_link( url_regex => qr/format=001/ ); - return $hits; + return $self->{hits} = $hits; } @@ -180,9 +180,11 @@ warn "## ++ ", dump( $f, $i1, $i2, @sf ); $self->save_marc( $id, $marc->as_usmarc ); - $nr++; - - $mech->follow_link( url_regex => qr/set_entry=0*$nr/ ); + if ( $nr < $self->{hits} ) { + $nr++; + diag "follow link to next record $nr"; + $mech->follow_link( url_regex => qr/set_entry=0*$nr/ ); + } return $marc->as_usmarc; } else {