bugfix: now database names are always transfered to filtering function
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 17 Feb 2005 18:08:14 +0000 (18:08 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 17 Feb 2005 18:08:14 +0000 (18:08 +0000)
(previously it work with Isis databases)

git-svn-id: file:///home/dpavlin/private/svn/webpac/trunk@672 13eb9ef6-21d5-0310-b721-a9d68796d827

all2xml.pl

index ae244dd..8f7e26c 100755 (executable)
@@ -633,6 +633,10 @@ if ($my_unac_filter) {
 
 foreach my $database ($cfg->Sections) {
 
 
 foreach my $database ($cfg->Sections) {
 
+       # save database name in global variable path for later
+       # (need for index filter creation)
+       $path = $database;
+
        my $type = lc($cfg -> val($database, 'type')) || die "$database doesn't have 'type' defined";
        my $add_xml = $cfg -> val($database, 'xml');    # optional
 
        my $type = lc($cfg -> val($database, 'type')) || die "$database doesn't have 'type' defined";
        my $add_xml = $cfg -> val($database, 'xml');    # optional
 
@@ -738,7 +742,7 @@ print STDERR "using: $type...\n";
                $import2cp = Text::Iconv->new($config->{isis_codepage},$codepage);
                my $db = new Biblio::Isis( isisdb => $isis_db );
 
                $import2cp = Text::Iconv->new($config->{isis_codepage},$codepage);
                my $db = new Biblio::Isis( isisdb => $isis_db );
 
-               my $max_rowid = $db->count;
+               my $max_rowid = $db->count if ($db);
 
                if (! $max_rowid) {
                        print STDERR "FATAL: can't read ISIS database: $isis_db, skipping...\n";
 
                if (! $max_rowid) {
                        print STDERR "FATAL: can't read ISIS database: $isis_db, skipping...\n";
@@ -747,8 +751,6 @@ print STDERR "using: $type...\n";
 
                print STDERR "Reading database: $isis_db [$max_rowid rows]\n";
 
 
                print STDERR "Reading database: $isis_db [$max_rowid rows]\n";
 
-               $path = $database;
-
                for (my $row_id = 1; $row_id <= $max_rowid; $row_id++ ) {
                        my $row = $db->to_hash( $row_id );
                        if ($row) {
                for (my $row_id = 1; $row_id <= $max_rowid; $row_id++ ) {
                        my $row = $db->to_hash( $row_id );
                        if ($row) {
@@ -830,6 +832,9 @@ print STDERR "using: $type...\n";
                                print "Document-Type: XML\n\n$xml\n";
                        }
                }
                                print "Document-Type: XML\n\n$xml\n";
                        }
                }
+
+               print STDERR "\n";
+
        } elsif ($type_base eq "marc") {
 
                require MARC::File::USMARC;
        } elsif ($type_base eq "marc") {
 
                require MARC::File::USMARC;