|
Lines 815-821
sub marc_records_to_documents {
Link Here
|
| 815 |
local $SIG{__WARN__} = sub { |
815 |
local $SIG{__WARN__} = sub { |
| 816 |
push @warnings, $_[0]; |
816 |
push @warnings, $_[0]; |
| 817 |
}; |
817 |
}; |
| 818 |
$record_document->{'marc_data'} = encode_base64(encode('UTF-8', $record->as_usmarc())); |
818 |
my $usmarc_record = $record->as_usmarc(); |
|
|
819 |
|
| 820 |
#NOTE: Try to round-trip the record to prove it will work for retrieval after searching |
| 821 |
my $decoded_usmarc_record = MARC::Record->new_from_usmarc($usmarc_record); |
| 822 |
if ($decoded_usmarc_record->warnings()){ |
| 823 |
#NOTE: We override the warnings since they're many and misleading |
| 824 |
@warnings = ( |
| 825 |
"Warnings encountered while roundtripping a MARC record to/from USMARC. Failing over to MARCXML.", |
| 826 |
); |
| 827 |
} |
| 828 |
|
| 829 |
my $marc_data = encode_base64(encode('UTF-8', $usmarc_record)); |
| 830 |
$record_document->{'marc_data'} = $marc_data; |
| 819 |
} |
831 |
} |
| 820 |
if (@warnings) { |
832 |
if (@warnings) { |
| 821 |
# Suppress warnings if record length exceeded |
833 |
# Suppress warnings if record length exceeded |
| 822 |
- |
|
|