requires 'MARC::Fast' => '0.12';
requires 'List::Util';
requires 'MARC::Record' => '2.0';
+requires 'MARC::File::XML';
requires 'Data::Dump';
requires 'MARC::Lint' => '1.43';
requires 'Business::ISBN' => '2.02'; # WebPAC::Normalize::ISBN
sudo apt-get install liblog-log4perl-perl libclass-accessor-perl libyaml-perl libtest-exception-perl \
libbiblio-isis-perl libmarc-lint-perl libppi-perl libspreadsheet-parseexcel-perl libtext-csv-perl \
- swish-e libhttp-oai-perl libbusiness-isbn-perl
+ swish-e libhttp-oai-perl libbusiness-isbn-perl libmarc-charset-perl libtest-warn-perl
use base qw/WebPAC::Common/;
use MARC::Record;
+use MARC::File::XML;
use MARC::Lint;
use Data::Dump qw/dump/;
binmode($self->{fh}, ':utf8');
$log->info("Creating MARC export file $path", $self->{lint} ? ' (with lint)' : '', " encoding ", $self->{marc_encoding}, "\n");
+ if ( $ENV{MARCXML} ) {
+ open($self->{fh_marcxml}, '>:utf8', "$path.marcxml");
+ print {$self->{fh_marcxml}} qq{<?xml version="1.0" encoding="UTF-8"?>\n<collection>\n};
+ }
} else {
$log->logconfess("new called without path");
}
print {$self->{fh}} $marc->as_usmarc;
+ if ( $self->{fh_marcxml} ) {
+ my $xml = $marc->as_xml_record;
+ $xml =~ s/\Q<?xml version="1.0" encoding="UTF-8"?>\E//;
+ print {$self->{fh_marcxml}} $xml;
+ }
}
=head2 finish
close( $self->{fh} ) or $log->logdie("can't close ", $self->{path}, ": $!");
+ if ( $self->{fh_marcxml} ) {
+ print {$self->{fh_marcxml}} qq{</collection>\n};
+ $log->info("MARCXML file size ", -s $self->{fh_marcxml}, " bytes");
+ close( $self->{fh_marcxml} );
+ }
if (my $w = $self->{_marc_lint_warnings}) {
$log->error("MARC lint warnings summary:\n",
join ("\n",