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; |
221 |
|
|
222 |
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)); |
223 |
|
|
224 |
my $lookup = new WebPAC::Lookup( |
my $lookup; |
225 |
lookup_file => $input->{lookup}, |
if ($input->{lookup}) { |
226 |
) if ($input->{lookup}); |
$lookup = new WebPAC::Lookup( |
227 |
|
lookup_file => $input->{lookup}, |
228 |
|
); |
229 |
|
delete( $input->{lookup} ); |
230 |
|
} |
231 |
|
|
232 |
my $input_module = $config->{webpac}->{inputs}->{$type}; |
my $input_module = $config->{webpac}->{inputs}->{$type}; |
233 |
|
|
237 |
|
|
238 |
my $input_db = new WebPAC::Input( |
my $input_db = new WebPAC::Input( |
239 |
module => $input_module, |
module => $input_module, |
240 |
code_page => $config->{webpac}->{webpac_encoding}, |
encoding => $config->{webpac}->{webpac_encoding}, |
241 |
limit => $limit || $input->{limit}, |
limit => $limit || $input->{limit}, |
242 |
offset => $offset, |
offset => $offset, |
243 |
lookup => $lookup, |
lookup_coderef => sub { |
244 |
|
my $rec = shift || return; |
245 |
|
$lookup->add( $rec ); |
246 |
|
}, |
247 |
recode => $input->{recode}, |
recode => $input->{recode}, |
248 |
stats => $stats, |
stats => $stats, |
249 |
); |
); |
321 |
type => $config->{$use_indexer}->{type}, |
type => $config->{$use_indexer}->{type}, |
322 |
) if ($indexer && $ds); |
) if ($indexer && $ds); |
323 |
|
|
324 |
$marc->add( |
if ($marc) { |
325 |
id => $mfn, |
my $i = 0; |
326 |
fields => [ WebPAC::Normalize::_get_marc_fields() ], |
|
327 |
leader => WebPAC::Normalize::marc_leader(), |
while (my $fields = WebPAC::Normalize::_get_marc_fields( fetch_next => 1 ) ) { |
328 |
row => $row, |
$marc->add( |
329 |
) if ($marc); |
id => $mfn . ( $i ? "/$i" : '' ), |
330 |
|
fields => $fields, |
331 |
|
leader => WebPAC::Normalize::marc_leader(), |
332 |
|
row => $row, |
333 |
|
); |
334 |
|
$i++; |
335 |
|
} |
336 |
|
|
337 |
|
$log->info("Created $i instances of MFN $mfn\n") if ($i > 1); |
338 |
|
} |
339 |
|
|
340 |
$total_rows++; |
$total_rows++; |
341 |
} |
} |