X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=Aleph.pm;h=8fdb1deb4061e87c3c4591000ed6fcee2cfadab4;hb=e3ce1e2363cba4e007d3159d969b2e319032eaf2;hp=3ad628719e82adfa00783573bc1a7c29182ecc7c;hpb=1a64df1b039682d68be71ad4e147f3cf4bcacf84;p=Biblio-Z3950.git diff --git a/Aleph.pm b/Aleph.pm index 3ad6287..8fdb1de 100644 --- a/Aleph.pm +++ b/Aleph.pm @@ -80,11 +80,13 @@ diag "advanced search"; $mech->follow_link( url_regex => qr/find-c/ ); + my $database = $self->{database}; + if ( $mech->content =~ m{Requested library is unavailable at the moment} ) { - warn "WARNING: default database not available"; + warn "ERROR: default database not available, try to swith to $database\n"; $self->save_content; - my $url = 'local_base=' . lc $self->{database}; - $mech->follow_link( url_regex => qr/$url/ ); + $mech->follow_link( url_regex => qr/local_base=$database/i ); + diag "re-try advanced search"; $mech->follow_link( url_regex => qr/find-c/ ); } @@ -144,6 +146,7 @@ warn "parse $nr"; sub field { my ( $f, $v ) = @_; $v =~ s/\Q \E/ /gs; + $v =~ s/\s+$//gs; warn "## $f\t$v\n"; $hash->{$f} = $v;