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}) {
By default turned on if normalisation file has C<marc*> directives. You can disable lint
messages with C<--no-marc-lint>.
+=item --marc-xml
+
+Creeate MARCXML file (this can be quite large)
+
=item --marc-dump
Force dump or input and marc record for debugging.
my $validate_path;
my $validate_delimiters_path;
my $marc_generate = 1;
-my $marc_lint = 1;
+my $marc_lint = 0;
my $marc_dump = 0;
+my $marc_xml = 0;
my $parallel = 0;
my $only_links = 0;
my $merge = 0;
"marc-generate!" => \$marc_generate,
"marc-lint!" => \$marc_lint,
"marc-dump!" => \$marc_dump,
+ "marcxml!" => \$marc_xml,
"parallel=i" => \$parallel,
"only-links!" => \$only_links,
"merge" => \$merge,
mkpath $out_marc unless -e $out_marc;
$marc = new WebPAC::Output::MARC(
- path => "$out_marc/${database}-${input_name}.marc",
+ path => "$out_marc/${database}-${input_name}",
lint => $marc_lint,
dump => $marc_dump,
+ marcxml => $marc_xml,
);
}