--- trunk/parse_format.pm 2004/03/12 15:06:58 263 +++ branches/cpi/parse_format.pm 2004/09/21 16:53:44 458 @@ -56,7 +56,7 @@ my $f = $format; my $eval; - $eval = $1 if ($f =~ s/^eval{([^}]+)}//); + $eval = $1 if ($f =~ s/^eval{([^}]+?)}//); if ($f =~ s/^([^\d]+)//) { if ($f) { # there is more to parse @@ -73,7 +73,7 @@ # print STDERR "\n#### $f"; # this is EBSCO special to support numeric subfield in # form of 856#3 - if ($f =~ s/^(\d\d\d)#*(\w?)//) { + if ($f =~ s/^(\d\d\d*)#*(\w?)//) { push @fmt,$1; if ($2) { push @fmt,$2; @@ -163,15 +163,17 @@ sub fld2str { my ($func,$row,$f,$sf,$i) = @_; #print STDERR "## in fld2str\n"; - my $tmp = &$func($row,$f,$sf,$i) || ''; + my $tmp = $codepage->convert(&$func($row,$f,$sf,$i)) || $codepage->convert(&$func($row,$f,$sf,0)) || ''; return "'$tmp'"; } $eval =~ s/v(\d+)\^(\w*)/fld2str($func,$row,$1,$2,$i)/eg; #print STDERR "## eval: $eval\n"; if (eval "$eval") { + die "eval error: eval{$eval}: $@" if ($@); return ($swish,$display); } else { + die "eval error: eval{$eval}: $@" if ($@); return (undef,undef); } } @@ -224,7 +226,7 @@ } elsif ($format =~ s/^([^A-Z\|]+)(\|[A-Z]{1,2}\|)/$2/) { $prefix .= $1 if ($display); } else { - print STDERR "unparsed format: $format\n"; + #print STDERR "unparsed format: $format\n"; $prefix .= $format; $format = ""; }