--- trunk/run.pl 2005/12/18 21:06:46 286 +++ trunk/run.pl 2005/12/18 23:10:02 290 @@ -9,7 +9,7 @@ use WebPAC::Common 0.02; use WebPAC::Lookup; -use WebPAC::Input::ISIS 0.02; +use WebPAC::Input 0.03; use WebPAC::Store 0.03; use WebPAC::Normalize::XML; use WebPAC::Output::TT; @@ -90,20 +90,15 @@ $log->info("working on input $input->{path} [$input->{type}] using $input_module"); - sub new_input { - my $name = shift; - my $args = shift; - new $name->($args); - } - - my $input = new_input($input_module,{ + my $input_db = new WebPAC::Input( + module => $input_module, code_page => $config->{webpac}->{webpac_encoding}, - limit_mfn => $input->{limit}, + limit => $input->{limit}, lookup => $lookup, - }); + ); $log->logdie("can't create input using $input_module") unless ($input); - my $maxmfn = $input->open( + my $maxmfn = $input_db->open( path => $input->{path}, code_page => $input->{encoding}, # database encoding ); @@ -130,11 +125,17 @@ ); } - for ( 0 ... $input->size ) { + foreach my $pos ( 0 ... $input_db->size ) { + + my $row = $input_db->fetch || next; - my $row = $input->fetch || next; + my $mfn = $row->{000}->[0] || $row->{000} || die "can't find MFN"; - my $mfn = $row->{'000'}->[0] || die "can't find MFN"; + if ($mfn =~ m#^\d+$#) { + $log->warn("record $pos doesn't have valid MFN but '$mfn', using $pos"); + $mfn = $pos; + $row->{000}->[0] = $pos; + } my $ds = $n->data_structure($row);