Aleph changed port
[Biblio-Z3950.git] / Aleph.pm
index 1696dc1..9aa6800 100644 (file)
--- a/Aleph.pm
+++ b/Aleph.pm
@@ -51,12 +51,12 @@ sub diag {
 
 sub usemap {{
        4               => 'WTI',
-       1003    => 'WTI',
-       16              => 'CU',
-       21              => 'SU',
-#      12              => '',
+       1003    => 'AUT',
+       16              => 'DDC',
+       21              => 'SUB',
+       12              => 'LCN',
 #      1007    => '',
-#      1016    => '',
+       1016    => 'WRD',
 }};
 
 our $session_id;
@@ -68,7 +68,7 @@ sub search {
 
        $session_id ||= int rand(1000000000);
        # FIXME allocate session just once
-       my $url = 'http://161.53.240.197:8991/F?RN=' . $session_id;
+       my $url = 'http://161.53.240.197:8992/F?RN=' . $session_id;
        # fake JavaScript code on page which creates random session
 
 diag "get $url";
@@ -146,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;
 
@@ -180,7 +181,7 @@ warn "## ++ ", dump( $f, $i1, $i2, @sf );
 
                my $id = $hash->{SYS} || die "no SYS";
 
-               $self->save_marc( $id, $marc->as_usmarc );
+               $self->save_marc( "$id.marc", $marc->as_usmarc );
 
                if ( $nr < $self->{hits} ) {
                        $nr++;
@@ -188,7 +189,7 @@ warn "## ++ ", dump( $f, $i1, $i2, @sf );
                        $mech->follow_link( url_regex => qr/set_entry=0*$nr/ );
                }
 
-               return $marc->as_usmarc;
+               return $id;
        } else {
                die "can't fetch COMARC format from ", $mech->content;
        }