7 |
use lib './lib'; |
use lib './lib'; |
8 |
|
|
9 |
use WebPAC::Common 0.02; |
use WebPAC::Common 0.02; |
10 |
use WebPAC::Lookup 0.03; |
use WebPAC::Parser 0.04; |
11 |
use WebPAC::Input 0.11; |
use WebPAC::Input 0.11; |
12 |
use WebPAC::Store 0.03; |
use WebPAC::Store 0.03; |
13 |
use WebPAC::Normalize 0.11; |
use WebPAC::Normalize 0.11; |
174 |
# disable indexing when creating marc |
# disable indexing when creating marc |
175 |
$use_indexer = undef if ($marc_normalize); |
$use_indexer = undef if ($marc_normalize); |
176 |
|
|
177 |
|
# parse normalize files and create source files for lookup and normalization |
178 |
|
|
179 |
|
my $parser = new WebPAC::Parser( config => $config ); |
180 |
|
|
181 |
my $total_rows = 0; |
my $total_rows = 0; |
182 |
my $start_t = time(); |
my $start_t = time(); |
183 |
|
|
313 |
|
|
314 |
die "I know only how to handle input types ", join(",", $config->webpac('inputs') ), " not '$type'!\n" unless (grep(/$type/, $config->webpac('inputs'))); |
die "I know only how to handle input types ", join(",", $config->webpac('inputs') ), " not '$type'!\n" unless (grep(/$type/, $config->webpac('inputs'))); |
315 |
|
|
|
my $lookup; |
|
|
if ($input->{lookup}) { |
|
|
$lookup = new WebPAC::Lookup( |
|
|
lookup_file => $input->{lookup}, |
|
|
); |
|
|
delete( $input->{lookup} ); |
|
|
} |
|
|
|
|
316 |
my $input_module = $config->webpac('inputs')->{$type}; |
my $input_module = $config->webpac('inputs')->{$type}; |
317 |
|
|
318 |
|
my @lookups = $parser->have_lookup_create($database, $input); |
319 |
|
|
320 |
$log->info("working on input '$input->{name}' in $input->{path} [type: $input->{type}] using $input_module", |
$log->info("working on input '$input->{name}' in $input->{path} [type: $input->{type}] using $input_module", |
321 |
$input->{lookup} ? "lookup '$input->{lookup}'" : "" |
@lookups ? "lookup ".join(", ", @lookups) : "" |
322 |
); |
); |
323 |
|
|
324 |
|
warn "lookups = ", dump( @lookups ); |
325 |
|
|
326 |
if ($stats) { |
if ($stats) { |
327 |
# disable modification of records if --stats is in use |
# disable modification of records if --stats is in use |
328 |
delete($input->{modify_records}); |
delete($input->{modify_records}); |
329 |
delete($input->{modify_file}); |
delete($input->{modify_file}); |
330 |
} |
} |
331 |
|
|
332 |
|
warn "parser->depends = ", dump( $parser->{depends} ); |
333 |
|
warn "depends on: ", dump( $parser->depends($database, $input->{name}) ); |
334 |
|
warn "lookup_create_rules = ", dump( $parser->lookup_create_rules($database, $input->{name}) ); |
335 |
|
warn "parser->_lookup_create = ", dump( $parser->{_lookup_create} ); |
336 |
|
|
337 |
|
my $lookup; |
338 |
|
|
339 |
my $input_db = new WebPAC::Input( |
my $input_db = new WebPAC::Input( |
340 |
module => $input_module, |
module => $input_module, |
341 |
encoding => $config->webpac('webpac_encoding'), |
encoding => $config->webpac('webpac_encoding'), |
352 |
); |
); |
353 |
$log->logdie("can't create input using $input_module") unless ($input); |
$log->logdie("can't create input using $input_module") unless ($input); |
354 |
|
|
355 |
|
if (defined( $input->{lookup} )) { |
356 |
|
$log->warn("$database/", $input->{name}, " has depriciated lookup definition, removing it..."); |
357 |
|
delete( $input->{lookup} ); |
358 |
|
} |
359 |
|
|
360 |
my $maxmfn = $input_db->open( |
my $maxmfn = $input_db->open( |
361 |
path => $input->{path}, |
path => $input->{path}, |
362 |
code_page => $input->{encoding}, # database encoding |
code_page => $input->{encoding}, # database encoding |