--- trunk/all2xml.pl 2004/01/31 21:03:06 207 +++ trunk/all2xml.pl 2004/03/05 22:53:30 231 @@ -321,7 +321,7 @@ } else { $display_data .= $ldel if ($display_data); my $tmp = mkformat($x,$display); - $display_data = $tmp if ($tmp); + $display_data .= $tmp if ($tmp); } } @@ -592,6 +592,8 @@ #tie %lhash, 'GDBM_File', $lookup_file, &GDBM_NEWDB, 0644; tie %lhash, 'TDB_File', $lookup_file, TDB_CLEAR_IF_FIRST, O_RDWR, 0644; print STDERR "creating lookup file '$lookup_file'\n"; + # delete memory cache for lookup file + delete $cache->{lhash}; } # open existing lookup file @@ -789,23 +791,26 @@ my $marc_file = $cfg -> val($database, 'marc_file') || die "$database doesn't have 'marc_file' defined!"; # optional argument is format - my $format = x($config->{format}) || 'usmarc'; + my $format = x($config->{marc_format}) || 'usmarc'; print STDERR "Reading MARC file '$marc_file'\n"; my $marc = new MARC; my $nr = $marc->openmarc({ file=>$marc_file, format=>$format - }) || die "Can't open MARC file '$marc_file'"; + }) || die "Can't open MARC file '$marc_file' with format '$format'"; - my $i=0; # record nr. + # read MARC file in memory + $marc->nextmarc(-1); - my $rec; + my $max_rec = $marc->marc_count(); - while ($marc->nextmarc(1)) { + for(my $i=1; $i<=$max_rec; $i++) { - # XXX - fakeprogress($i++); + progress($i,$max_rec); + + # store value for marc_sf.pm + $main::cache->{marc_record} = $i; my $swishpath = $database."#".$i; @@ -817,6 +822,9 @@ print "Document-Type: XML\n\n$xml\n"; } } + + print STDERR "\n"; + } elsif ($type_base eq "feed") { $import2cp = Text::Iconv->new($config->{feed_codepage},$codepage);