if but not if defined?
[migration-tools.git] / fingerprinter
index 9b973b8..a08efea 100755 (executable)
@@ -75,7 +75,7 @@ sub populate_marc {
     # date1, date2
     my $my_008 = $record->field('008');
     $my_008 = $my_008->as_string() if ($my_008);
-    unless (length $my_008 == 40)
+    unless (defined $my_008 and length $my_008 == 40)
       { print XF ">> Bad 008 field length in rec. $id\n"; return \%marc }
     $marc{date1} = substr($my_008,7,4) if ($my_008);
     $marc{date2} = substr($my_008,11,4) if ($my_008); # UNUSED
@@ -113,7 +113,7 @@ sub populate_marc {
     $marc{desc} = $record->field('300')->subfield('a') if $record->field('300');
     $marc{pages} = $1 if (defined $marc{desc} and $marc{desc} =~ /(\d+)/);
     $marc{title} = $record->field('245')->subfield('a')
-      if defined $record->field('245');
+      if $record->field('245');
     $marc{edition} = $record->field('250')->subfield('a')
       if $record->field('250');
     if ($record->field('260')) {
@@ -318,7 +318,7 @@ sub initialize {
 
 sub progress_ticker {
     return if $conf->{quiet};
-    printf("> %d (%d/s)\r", $count, ($count / (time - $start)))
+    printf("> %d (%d/s)\r", $count, ($count / (time - $start + 1)))
       if ($count % 100 == 0);
 }