include_subfields with option -h
[MARC-Fast] / Fast.pm
diff --git a/Fast.pm b/Fast.pm
index aa510ba..f944654 100644 (file)
--- a/Fast.pm
+++ b/Fast.pm
@@ -2,7 +2,7 @@ package MARC::Fast;
 
 use strict;
 use Carp;
-use Data::Dumper;
+use Data::Dump qw/dump/;
 
 BEGIN {
        use Exporter ();
@@ -124,6 +124,7 @@ sub new {
 
                # skip to next record
                my $o = substr($leader,0,5);
+               warn "# in record ", $self->{count}," record length isn't number but: ",dump($o),"\n" unless $o =~ m/^\d+$/;
                if ($o > 24) {
                        seek($self->{fh},$o-24,1) if ($o);
                } else {
@@ -336,7 +337,7 @@ sub to_hash {
 
                                        # repeatable subfiled -- convert it to array
                                        if ($val->{$f}) {
-                                               if ( $sf_usage->{$f} == 2 ) {
+                                               if ( ref($val->{$f}) ne 'ARRAY' ) {
                                                        $val->{$f} = [ $val->{$f}, $val ];
                                                } else {
                                                        push @{$val->{$f}}, $val;