ignore \N fields (NULL)
[webpac2] / bin / dump2marc.pl
index daf15cc..60546c6 100755 (executable)
@@ -9,6 +9,7 @@ use MARC::Record;
 use Data::Dump qw(dump);
 use Encode;
 
+my $debug = 0;
 my @fields;
 
 sub parse_subfields {
@@ -38,19 +39,19 @@ while(<>) {
        } elsif ( /^\s{7}_([a-z])(.+)$/ ) {
                push @{ $fields[ $#fields ] }, $1, $2;
        } elsif ( /^$/ ) {
-               warn dump( @fields );
+               warn dump( @fields ) if $debug;
 
                my $marc = new MARC::Record;
                $marc->encoding( 'utf-8' );
                $marc->leader( $leader );
                $marc->add_fields( @fields );
 
-               warn $marc->as_formatted;
+               warn $marc->as_formatted, $/, $/;
                print $marc->as_usmarc;
 
                @fields = ();
        } else {
-               warn "IGNORED: $_\n";
+               warn "IGNORED: $_\n" if $debug;
        }
 
 }