|
Lines 379-389
sub marc_records_to_documents {
Link Here
|
| 379 |
} |
379 |
} |
| 380 |
# TODO: Perhaps should check if $records_document non empty, but really should never be the case |
380 |
# TODO: Perhaps should check if $records_document non empty, but really should never be the case |
| 381 |
$record->encoding('UTF-8'); |
381 |
$record->encoding('UTF-8'); |
| 382 |
if ($serialization_format eq 'base64ISO2709') { |
382 |
my @warnings; |
|
|
383 |
{ |
| 384 |
# Temporarily intercept all warn signals (MARC::Record carps when record length > 99999) |
| 385 |
local $SIG{__WARN__} = sub { |
| 386 |
push @warnings, $_[0]; |
| 387 |
}; |
| 383 |
$record_document->{'marc_data'} = encode_base64(encode('UTF-8', $record->as_usmarc())); |
388 |
$record_document->{'marc_data'} = encode_base64(encode('UTF-8', $record->as_usmarc())); |
| 384 |
} |
389 |
} |
| 385 |
else { |
390 |
if (@warnings) { |
|
|
391 |
# Suppress warnings if record length exceeded |
| 392 |
unless (substr($record->leader(), 0, 5) eq '99999') { |
| 393 |
foreach my $warning (@warnings) { |
| 394 |
carp($warning); |
| 395 |
} |
| 396 |
} |
| 386 |
$record_document->{'marc_data'} = $record->as_xml_record($marcflavour); |
397 |
$record_document->{'marc_data'} = $record->as_xml_record($marcflavour); |
|
|
398 |
$record_document->{'marc_format'} = 'MARCXML'; |
| 399 |
} |
| 400 |
else { |
| 401 |
$record_document->{'marc_format'} = 'base64ISO2709'; |
| 387 |
} |
402 |
} |
| 388 |
my $id = $record->subfield('999', 'c'); |
403 |
my $id = $record->subfield('999', 'c'); |
| 389 |
push @record_documents, [$id, $record_document]; |
404 |
push @record_documents, [$id, $record_document]; |