marc_encoding => 'utf-8',
lint => 1,
dump => 0,
+ marcxml => 0,
)
=cut
$self->{marc_encoding} ||= 'utf-8';
if (my $path = $self->{path}) {
- open($self->{fh}, '>', $path) ||
+ open($self->{fh}, '>', $path . '.marc') ||
$log->logdie("can't open MARC output $path: $!");
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");
+ $log->info("Creating MARC export file $path.marc", $self->{lint} ? ' (with lint)' : '', " encoding ", $self->{marc_encoding}, "\n");
+ if ( $self->{marcxml} || $ENV{MARCXML} ) {
+ open($self->{fh_marcxml}, '>:utf8', "$path.marcxml") ||
+ $log->logdie("can't open MARCXML output $path.marcxml: $!");
+ $log->info("Creating MARCXML export file $path.marcxml");
print {$self->{fh_marcxml}} qq{<?xml version="1.0" encoding="UTF-8"?>\n<collection>\n};
}
} else {
my $log = $self->get_logger;
- close( $self->{fh} ) or $log->logdie("can't close ", $self->{path}, ": $!");
+ close( $self->{fh} ) or $log->logdie("can't close ", $self->{path}, ".marc: $!");
if ( $self->{fh_marcxml} ) {
print {$self->{fh_marcxml}} qq{</collection>\n};
- $log->info("MARCXML file size ", -s $self->{fh_marcxml}, " bytes");
+ $log->info("MARCXML file ", $self->{path}, ".marcxml ", -s $self->{fh_marcxml}, " bytes");
close( $self->{fh_marcxml} );
}
if (my $w = $self->{_marc_lint_warnings}) {