From: Jason Etheridge Date: Fri, 25 Jul 2008 16:20:24 +0000 (+0000) Subject: just a tool to see if MARC::Record can parse all the records you throw at it X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=commitdiff_plain;h=06aca1f9bcbba48cc8d3f2891fef82a3ba4b6b42 just a tool to see if MARC::Record can parse all the records you throw at it --- 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 $@; +}