From 61545ffa452fa6c95446207b67ce2e7dda704db7 Mon Sep 17 00:00:00 2001 From: Rogan Hamby Date: Tue, 14 Jul 2020 13:32:58 -0400 Subject: [PATCH] make mig-bibstats able to read marcxml or marc21 --- emig.d/bin/mig-bibstats | 11 +++++++---- kmig.d/bin/mig-bibstats | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/emig.d/bin/mig-bibstats b/emig.d/bin/mig-bibstats index cfb382a..c3629af 100755 --- a/emig.d/bin/mig-bibstats +++ b/emig.d/bin/mig-bibstats @@ -110,11 +110,14 @@ if ($p_holding_code) { #to do - add a check for exportbarcodes being in @ilses -my $batch = MARC::Batch->new('USMARC', $file); -$batch->strict_off(); my $filetype = `file $file`; -if ($filetype =~ m/MARC21/ or $p_ignore_filetype eq 'true') { print "$filetype.\n" } - else { abort("File is not MARC21."); } +my $batch; +if ($filetype =~ m/MARC21/) { + $batch = MARC::Batch->new( 'USMARC', $file ); +} else { + $batch = MARC::Batch->new( 'XML', $file ); +} +$batch->strict_off(); my $i = 0; my $uri_count = 0; diff --git a/kmig.d/bin/mig-bibstats b/kmig.d/bin/mig-bibstats index e8ed795..c2568bd 100755 --- a/kmig.d/bin/mig-bibstats +++ b/kmig.d/bin/mig-bibstats @@ -110,11 +110,14 @@ if ($p_holding_code) { #to do - add a check for exportbarcodes being in @ilses -my $batch = MARC::Batch->new('USMARC', $file); -$batch->strict_off(); my $filetype = `file $file`; -if ($filetype =~ m/MARC21/ or $p_ignore_filetype eq 'true') { print "$filetype.\n" } - else { abort("File is not MARC21."); } +my $batch; +if ($filetype =~ m/MARC21/) { + $batch = MARC::Batch->new( 'USMARC', $file ); +} else { + $batch = MARC::Batch->new( 'XML', $file ); +} +$batch->strict_off(); my $i = 0; my $uri_count = 0; -- 1.7.2.5