sub stow_record_data {
# get tag data if we're looking at it
my $tag = 0;
- if ($record[$ptr] =~ m/<(control|data)field tag="(?<TAG>.{3})"/) {
- $recmeta{tag} = $+{TAG};
+ if ($record[$ptr] =~ m/<(?:control|data)field tag="(.{3})"/) {
+ $recmeta{tag} = $1;
$tag = $recmeta{tag};
- $record[$ptr] =~ m/ind1="(?<IND1>.)"/;
- $recmeta{ind1} = $+{IND1} || '';
- $record[$ptr] =~ m/ind2="(?<IND2>.)"/;
- $recmeta{ind2} = $+{IND2} || '';
+ $record[$ptr] =~ m/ind1="(.)"/;
+ $recmeta{ind1} = $1 || '';
+ $record[$ptr] =~ m/ind2="(.)"/;
+ $recmeta{ind2} = $1 || '';
unless ($tag) {
message("Autokill record: no detectable tag");
show_trashhelp() if ($c->{trashhelp});
# defaults
- my $pfx = $c->{prefix} // "bibs";
+ my $pfx = defined($c->{prefix}) ? $c->{prefix} : "bibs";
$c->{ricount} = 0;
$c->{rocount} = 0;
- $c->{output} = join('.',$c->{prefix},'clean','marc','xml');
- $c->{exception} = join('.',$c->{prefix},'exception','marc','xml');
$c->{'renumber-tag'} = 903 unless defined $c->{'renumber-tag'};
$c->{'renumber-subfield'} = 'a' unless defined $c->{'renumber-subfield'};
$c->{window} = 9;
-
- $c->{marcfile} = $c->{prefix} . '.marc.xml'
- unless $c->{marcfile};
+ if ($c->{prefix}) {
+ $c->{output} = join('.',$c->{prefix},'clean','marc','xml')
+ unless $c->{output};
+ $c->{exception} = join('.',$c->{prefix},'exception','marc','xml')
+ unless $c->{exception};
+ $c->{marcfile} = $c->{prefix} . '.marc.xml'
+ unless $c->{marcfile};
+ }
+ show_help() unless ($c->{marcfile} and $c->{output});
if ($c->{trashfile}) {
$c->{trash} = Equinox::Migration::SimpleTagList->new(file => $c->{trashfile})
# remove original id sequence tag from trash hash if we know it
$c->{trash}->remove_tag($c->{'original-tag'})
if ( $c->{'original-tag'} and $c->{trash}->has($c->{'original-tag'}) );
-
- my @keys = keys %{$c};
- show_help() unless @keys;
}
sub show_help {
print <<HELP;
-Usage is: marc-cleanup [OPTIONS] <filelist>
+Usage is: marc_cleanup [OPTIONS] <filelist>
Options
--output -o Cleaned MARCXML output filename
--exception -x Exception (dumped records) MARCXML filename
or
- --prefix=<PREFIX>> -p Shared prefix for output/exception files. Will produce
+ --prefix=<PREFIX> -p Shared prefix for output/exception files. Will produce
PREFIX.clean.marc.xml and PREFIX.exception.marc.xml
--marcfile -m Input filename. Defaults to PREFIX.marc.xml
--fullauto No manual edits. All problematic records dumped to
exception file.
- --script Store human-initiated ops in scriptfile (.mcscript)
- Not yet implemented
HELP
exit;
}