--- trunk2/lib/WebPAC.pm 2004/10/29 22:05:51 554 +++ trunk2/lib/WebPAC.pm 2004/10/29 22:09:04 555 @@ -570,6 +570,8 @@ # iteration (for repeatable fields) my $i = shift || 0; + $log->logdie("infitite loop in format $format") if ($i > ($self->{'max_mfn'} || 9999)); + # FIXME remove for speedup? $log->logconfess("need HASH as first argument!") if ($rec !~ /HASH/o); @@ -588,7 +590,10 @@ $filter_name = $1 if ($format =~ s/^filter{([^}]+)}//s); # do actual replacement of placeholders + # repeatable fields $format =~ s/v(\d+)(?:\^(\w))?/$self->get_data(\$rec,$1,$2,$i,\$found)/ges; + # non-repeatable fields + $format =~ s/s(\d+)(?:\^(\w))?/$self->get_data(\$rec,$1,$2,0,\$found)/ges; if ($found) { $log->debug("format: $format"); @@ -701,13 +706,17 @@ my $prefix; my $all_found=0; - while ($format =~ s/^(.*?)v(\d+)(?:\^(\w))?//s) { + while ($format =~ s/^(.*?)(v|s)(\d+)(?:\^(\w))?//s) { my $del = $1 || ''; $prefix ||= $del if ($all_found == 0); + # repeatable index + my $r = $i; + $r = 0 if (lc("$2") eq 's'); + my $found = 0; - my $tmp = $self->get_data(\$rec,$2,$3,$i,\$found); + my $tmp = $self->get_data(\$rec,$3,$4,$r,\$found); if ($found) { push @out, $del;