just a tool to see if MARC::Record can parse all the records you throw at it
authorJason Etheridge <jason@esilibrary.com>
Fri, 25 Jul 2008 16:20:24 +0000 (16:20 +0000)
committerJason Etheridge <jason@esilibrary.com>
Fri, 25 Jul 2008 16:20:24 +0000 (16:20 +0000)
spot_check.pl [new file with mode: 0644]

diff --git a/spot_check.pl b/spot_check.pl
new file mode 100644 (file)
index 0000000..17a6e51
--- /dev/null
@@ -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 $@;
+}