3 use MARC::File::XML ( BinaryEncoding => 'utf-8' );
5 use Unicode::Normalize;
9 binmode(STDOUT, ':utf8');
10 binmode(STDIN, ':utf8');
12 foreach my $argnum ( 0 .. $#ARGV ) {
14 print STDERR "Processing " . $ARGV[$argnum] . "\n";
17 open $M, '<:utf8', $ARGV[$argnum];
18 my $batch = MARC::Batch->new('XML',$M);
21 $batch->warnings_off();
23 while ( my $record = $batch->next() ) {
27 print STDERR "WARNINGS: Record $count : " . join(":",@warnings) . " : continuing...\n" if ( @warnings );
29 my @my001 = $record->field('001');
30 if (scalar(@my001) == 0 || scalar(@my001) > 1) { die "Wrong number of 001 tags for record $count\n"; }
31 my @my903 = $record->field('903');
32 if (scalar(@my903) == 0 || scalar(@my903) > 1) { die "Wrong number of 903 tags for record $count\n"; }
33 print $my903[0]->subfield('a') . "\t" . $my001[0]->as_string() . "\n"
35 print STDERR "Processed $count records\n";