--- trunk/run.pl 2006/09/24 15:53:54 684 +++ trunk/run.pl 2006/09/25 14:06:49 706 @@ -7,7 +7,7 @@ use lib './lib'; use WebPAC::Common 0.02; -use WebPAC::Lookup 0.03; +use WebPAC::Parser 0.04; use WebPAC::Input 0.11; use WebPAC::Store 0.03; use WebPAC::Normalize 0.11; @@ -174,6 +174,10 @@ # disable indexing when creating marc $use_indexer = undef if ($marc_normalize); +# parse normalize files and create source files for lookup and normalization + +my $parser = new WebPAC::Parser( config => $config ); + my $total_rows = 0; my $start_t = time(); @@ -309,26 +313,29 @@ die "I know only how to handle input types ", join(",", $config->webpac('inputs') ), " not '$type'!\n" unless (grep(/$type/, $config->webpac('inputs'))); - my $lookup; - if ($input->{lookup}) { - $lookup = new WebPAC::Lookup( - lookup_file => $input->{lookup}, - ); - delete( $input->{lookup} ); - } - my $input_module = $config->webpac('inputs')->{$type}; + my @lookups = $parser->have_lookup_create($database, $input); + $log->info("working on input '$input->{name}' in $input->{path} [type: $input->{type}] using $input_module", - $input->{lookup} ? "lookup '$input->{lookup}'" : "" + @lookups ? "lookup ".join(", ", @lookups) : "" ); +warn "lookups = ", dump( @lookups ); + if ($stats) { # disable modification of records if --stats is in use delete($input->{modify_records}); delete($input->{modify_file}); } + warn "parser->depends = ", dump( $parser->{depends} ); + warn "depends on: ", dump( $parser->depends($database, $input->{name}) ); + warn "lookup_create_rules = ", dump( $parser->lookup_create_rules($database, $input->{name}) ); + warn "parser->_lookup_create = ", dump( $parser->{_lookup_create} ); + + my $lookup; + my $input_db = new WebPAC::Input( module => $input_module, encoding => $config->webpac('webpac_encoding'), @@ -345,6 +352,11 @@ ); $log->logdie("can't create input using $input_module") unless ($input); + if (defined( $input->{lookup} )) { + $log->warn("$database/", $input->{name}, " has depriciated lookup definition, removing it..."); + delete( $input->{lookup} ); + } + my $maxmfn = $input_db->open( path => $input->{path}, code_page => $input->{encoding}, # database encoding