570 |
# iteration (for repeatable fields) |
# iteration (for repeatable fields) |
571 |
my $i = shift || 0; |
my $i = shift || 0; |
572 |
|
|
573 |
|
$log->logdie("infitite loop in format $format") if ($i > ($self->{'max_mfn'} || 9999)); |
574 |
|
|
575 |
# FIXME remove for speedup? |
# FIXME remove for speedup? |
576 |
$log->logconfess("need HASH as first argument!") if ($rec !~ /HASH/o); |
$log->logconfess("need HASH as first argument!") if ($rec !~ /HASH/o); |
577 |
|
|
590 |
$filter_name = $1 if ($format =~ s/^filter{([^}]+)}//s); |
$filter_name = $1 if ($format =~ s/^filter{([^}]+)}//s); |
591 |
|
|
592 |
# do actual replacement of placeholders |
# do actual replacement of placeholders |
593 |
|
# repeatable fields |
594 |
$format =~ s/v(\d+)(?:\^(\w))?/$self->get_data(\$rec,$1,$2,$i,\$found)/ges; |
$format =~ s/v(\d+)(?:\^(\w))?/$self->get_data(\$rec,$1,$2,$i,\$found)/ges; |
595 |
|
# non-repeatable fields |
596 |
|
$format =~ s/s(\d+)(?:\^(\w))?/$self->get_data(\$rec,$1,$2,0,\$found)/ges; |
597 |
|
|
598 |
if ($found) { |
if ($found) { |
599 |
$log->debug("format: $format"); |
$log->debug("format: $format"); |
706 |
my $prefix; |
my $prefix; |
707 |
my $all_found=0; |
my $all_found=0; |
708 |
|
|
709 |
while ($format =~ s/^(.*?)v(\d+)(?:\^(\w))?//s) { |
while ($format =~ s/^(.*?)(v|s)(\d+)(?:\^(\w))?//s) { |
710 |
|
|
711 |
my $del = $1 || ''; |
my $del = $1 || ''; |
712 |
$prefix ||= $del if ($all_found == 0); |
$prefix ||= $del if ($all_found == 0); |
713 |
|
|
714 |
|
# repeatable index |
715 |
|
my $r = $i; |
716 |
|
$r = 0 if (lc("$2") eq 's'); |
717 |
|
|
718 |
my $found = 0; |
my $found = 0; |
719 |
my $tmp = $self->get_data(\$rec,$2,$3,$i,\$found); |
my $tmp = $self->get_data(\$rec,$3,$4,$r,\$found); |
720 |
|
|
721 |
if ($found) { |
if ($found) { |
722 |
push @out, $del; |
push @out, $del; |