7 |
use lib './lib'; |
use lib './lib'; |
8 |
|
|
9 |
use WebPAC::Common 0.02; |
use WebPAC::Common 0.02; |
10 |
use WebPAC::Lookup; |
use WebPAC::Lookup 0.03; |
11 |
use WebPAC::Input 0.03; |
use WebPAC::Input 0.07; |
12 |
use WebPAC::Store 0.03; |
use WebPAC::Store 0.03; |
13 |
use WebPAC::Normalize; |
use WebPAC::Normalize 0.11; |
14 |
use WebPAC::Output::TT; |
use WebPAC::Output::TT; |
15 |
use WebPAC::Validate; |
use WebPAC::Validate; |
16 |
use WebPAC::Output::MARC; |
use WebPAC::Output::MARC; |
20 |
use Time::HiRes qw/time/; |
use Time::HiRes qw/time/; |
21 |
use File::Slurp; |
use File::Slurp; |
22 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
23 |
|
use Storable qw/dclone/; |
24 |
|
|
25 |
=head1 NAME |
=head1 NAME |
26 |
|
|
222 |
|
|
223 |
die "I know only how to handle input types ", join(",", @supported_inputs), " not '$type'!\n" unless (grep(/$type/, @supported_inputs)); |
die "I know only how to handle input types ", join(",", @supported_inputs), " not '$type'!\n" unless (grep(/$type/, @supported_inputs)); |
224 |
|
|
225 |
my $lookup = new WebPAC::Lookup( |
my $lookup; |
226 |
lookup_file => $input->{lookup}, |
if ($input->{lookup}) { |
227 |
) if ($input->{lookup}); |
$lookup = new WebPAC::Lookup( |
228 |
|
lookup_file => $input->{lookup}, |
229 |
|
); |
230 |
|
delete( $input->{lookup} ); |
231 |
|
} |
232 |
|
|
233 |
my $input_module = $config->{webpac}->{inputs}->{$type}; |
my $input_module = $config->{webpac}->{inputs}->{$type}; |
234 |
|
|
238 |
|
|
239 |
my $input_db = new WebPAC::Input( |
my $input_db = new WebPAC::Input( |
240 |
module => $input_module, |
module => $input_module, |
241 |
code_page => $config->{webpac}->{webpac_encoding}, |
encoding => $config->{webpac}->{webpac_encoding}, |
242 |
limit => $limit || $input->{limit}, |
limit => $limit || $input->{limit}, |
243 |
offset => $offset, |
offset => $offset, |
244 |
lookup => $lookup, |
lookup_coderef => sub { |
245 |
|
my $rec = shift || return; |
246 |
|
$lookup->add( $rec ); |
247 |
|
}, |
248 |
recode => $input->{recode}, |
recode => $input->{recode}, |
249 |
stats => $stats, |
stats => $stats, |
250 |
|
modify_records => $input->{modify_records}, |
251 |
); |
); |
252 |
$log->logdie("can't create input using $input_module") unless ($input); |
$log->logdie("can't create input using $input_module") unless ($input); |
253 |
|
|
304 |
$log->error( "MFN $mfn validation errors:\n", join("\n", @errors) ) if (@errors); |
$log->error( "MFN $mfn validation errors:\n", join("\n", @errors) ) if (@errors); |
305 |
} |
} |
306 |
|
|
307 |
|
my $ds_config = dclone($db_config); |
308 |
|
|
309 |
|
# default values -> database key |
310 |
|
$ds_config->{_} = $database; |
311 |
|
|
312 |
|
# current mfn |
313 |
|
$ds_config->{_mfn} = $mfn; |
314 |
|
|
315 |
|
# attach current input |
316 |
|
$ds_config->{input} = $input; |
317 |
|
|
318 |
my $ds = WebPAC::Normalize::data_structure( |
my $ds = WebPAC::Normalize::data_structure( |
319 |
row => $row, |
row => $row, |
320 |
rules => $rules, |
rules => $rules, |
321 |
lookup => $lookup ? $lookup->lookup_hash : undef, |
lookup => $lookup ? $lookup->lookup_hash : undef, |
322 |
|
config => $ds_config, |
323 |
marc_encoding => 'utf-8', |
marc_encoding => 'utf-8', |
324 |
); |
); |
325 |
|
|