Lines 806-818
sub marc_records_to_documents {
Link Here
|
806 |
|
806 |
|
807 |
# TODO: Perhaps should check if $records_document non empty, but really should never be the case |
807 |
# TODO: Perhaps should check if $records_document non empty, but really should never be the case |
808 |
$record->encoding('UTF-8'); |
808 |
$record->encoding('UTF-8'); |
809 |
if ($marcformat_syspref eq 'ARRAY') { |
809 |
if ( $marcformat_syspref eq 'ARRAY' ) { |
810 |
$record_document->{'marc_data_array'} = $self->_marc_to_array($record); |
810 |
$record_document->{'marc_data_array'} = $self->_marc_to_array($record); |
811 |
$record_document->{'marc_format'} = 'ARRAY'; |
811 |
$record_document->{'marc_format'} = 'ARRAY'; |
812 |
} elsif ($marcformat_syspref eq 'MARCXML'){ |
812 |
} elsif ( $marcformat_syspref eq 'MARCXML' ) { |
813 |
$record_document->{'marc_data'} = $record->as_xml_record($marcflavour); |
813 |
$record_document->{'marc_data'} = $record->as_xml_record($marcflavour); |
814 |
$record_document->{'marc_format'} = 'MARCXML'; |
814 |
$record_document->{'marc_format'} = 'MARCXML'; |
815 |
} elsif ($marcformat_syspref eq 'MARCXML_COMPRESSED'){ |
815 |
} elsif ( $marcformat_syspref eq 'MARCXML_COMPRESSED' ) { |
816 |
my $deflate = deflateInit( -Level => Z_BEST_COMPRESSION ); |
816 |
my $deflate = deflateInit( -Level => Z_BEST_COMPRESSION ); |
817 |
my $output = ""; |
817 |
my $output = ""; |
818 |
if ($deflate) { |
818 |
if ($deflate) { |
Lines 833-851
sub marc_records_to_documents {
Link Here
|
833 |
local $SIG{__WARN__} = sub { |
833 |
local $SIG{__WARN__} = sub { |
834 |
push @warnings, $_[0]; |
834 |
push @warnings, $_[0]; |
835 |
}; |
835 |
}; |
836 |
$record_document->{'marc_data'} = encode_base64(encode('UTF-8', $record->as_usmarc())); |
836 |
$record_document->{'marc_data'} = encode_base64( encode( 'UTF-8', $record->as_usmarc() ) ); |
837 |
} |
837 |
} |
838 |
if (@warnings) { |
838 |
if (@warnings) { |
|
|
839 |
|
839 |
# Suppress warnings if record length exceeded |
840 |
# Suppress warnings if record length exceeded |
840 |
unless (substr($record->leader(), 0, 5) eq '99999') { |
841 |
unless ( substr( $record->leader(), 0, 5 ) eq '99999' ) { |
841 |
foreach my $warning (@warnings) { |
842 |
foreach my $warning (@warnings) { |
842 |
carp $warning; |
843 |
carp $warning; |
843 |
} |
844 |
} |
844 |
} |
845 |
} |
845 |
$record_document->{'marc_data'} = $record->as_xml_record($marcflavour); |
846 |
$record_document->{'marc_data'} = $record->as_xml_record($marcflavour); |
846 |
$record_document->{'marc_format'} = 'MARCXML'; |
847 |
$record_document->{'marc_format'} = 'MARCXML'; |
847 |
} |
848 |
} else { |
848 |
else { |
|
|
849 |
$record_document->{'marc_format'} = 'base64ISO2709'; |
849 |
$record_document->{'marc_format'} = 'base64ISO2709'; |
850 |
} |
850 |
} |
851 |
} |
851 |
} |