From 06aca1f9bcbba48cc8d3f2891fef82a3ba4b6b42 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Fri, 25 Jul 2008 16:20:24 +0000 Subject: [PATCH] just a tool to see if MARC::Record can parse all the records you throw at it --- spot_check.pl | 35 +++++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+), 0 deletions(-) create mode 100644 spot_check.pl diff --git a/spot_check.pl b/spot_check.pl new file mode 100644 index 0000000..17a6e51 --- /dev/null +++ b/spot_check.pl @@ -0,0 +1,35 @@ +#!/usr/bin/perl +use MARC::Batch; +use MARC::Record; +use MARC::File::XML ( BinaryEncoding => 'utf-8' ); +use MARC::Field; + +my $count = 0; + +binmode(STDOUT, ':utf8'); +binmode(STDIN, ':utf8'); + +foreach $argnum ( 0 .. $#ARGV ) { + + print STDERR "Processing " . $ARGV[$argnum] . "\n"; + + my $batch = MARC::Batch->new('XML',$ARGV[$argnum]); + $batch->strict_off(); + $batch->warnings_off(); + + my $last_successful_record; + + eval { + while ( my $record = $batch->next() ) { + + $count++; + + $last_successful_record = $record->as_xml(); + + print STDERR "WARNINGS: Record $count : " . join(":",@warnings) . " : continuing...\n" if ( @warnings ); + + } + }; + print STDERR "Processed $count records. Last successful record = " . $last_successful_record . "\n"; + warn $@ if $@; +} -- 1.7.2.5