strip whitespaces around query which confuse parser
[Biblio-Z3950.git] / CROSBI.pm
index 6164e52..c6651a0 100644 (file)
--- a/CROSBI.pm
+++ b/CROSBI.pm
@@ -58,9 +58,14 @@ sub search {
 
        die "need query" unless defined $query;
 
+       $query =~ s/^\s+//;
+       $query =~ s/\s+$//;
+
        my $table = lc $self->{database};
        $table =~ s/^crosbi-//g;
 
+       $self->{_table} = $table;
+
        my $sql = qq{
 
 select distinct *
@@ -197,12 +202,12 @@ sub next_marc {
 ## LDR 06 - a - language material 
 ## LDR 07 - a - monographic component part 
 
-       $leader =~ s/^(....)...(.+)/$1naa$2/;
+       $leader =~ s/^(.....)...(.+)/$1naa$2/;
 
 ## LDR 17 - Encoding level ; 7 - minimal level, u - unknown
 ## LDR 18 - i = isbd ; u = unknown
 
-       $leader =~ s/^(.{17})..(.+)/$1uu$2/;
+       $leader =~ s/^(.{17})..(.+)/$1ui$2/;
 
        $marc->leader( $leader );
        warn "# leader [$leader]";
@@ -416,7 +421,9 @@ sub next_marc {
        }
 
        my @f942 = (
-               c => 'CLA'
+               c => $self->{_table} eq 'casopis'  ? 'CLA' :
+                    $self->{_table} eq 'preprint' ? 'PRE' :
+                       'FIXME',
        );
        if ( $row->{status_rada} ) {
                push @f942, (