--- trunk/lib/WebPAC/Normalize.pm 2006/07/02 20:14:21 564 +++ trunk/lib/WebPAC/Normalize.pm 2006/07/02 21:17:54 566 @@ -457,7 +457,7 @@ while (@_) { my $sf = shift or die "marc_compose $f needs subfield"; - my $v = shift or die "marc_compose $f needs value for subfield $sf"; + my $v = shift; next unless (defined($v) && $v !~ /^\s*$/); from_to($v, 'iso-8859-2', $marc_encoding) if ($marc_encoding); @@ -467,7 +467,7 @@ warn "## marc_compose(d) ", dump( $m ) if ($debug > 1); - push @{ $marc_record }, $m; + push @{ $marc_record }, $m if ($#{$m} > 2); } @@ -664,12 +664,14 @@ my $v = shift @r; warn "### first rec($fld,$sf) = ",dump($v) if ($debug > 2); + return '' if( ! defined($v) || $v =~ /^\s*$/); + my @s = split( $regex, $v ); warn "## split_rec_on($fld,$sf,$regex,$part) = ",dump(@s) if ($debug > 1); - if ($part > 0) { + if ($part && $part > 0) { return $s[ $part - 1 ]; } else { - return @s; + return [ @s ]; } }