--- trunk2/lib/WebPAC.pm 2004/06/16 14:31:33 358 +++ trunk2/lib/WebPAC.pm 2004/06/16 15:41:16 359 @@ -268,10 +268,18 @@ my $found = 0; + my $eval_code; + # remove eval{...} from beginning + $eval_code = $1 if ($format =~ s/^eval{([^}]+)}//s); + # do actual replacement of placeholders $format =~ s/v(\d+)(?:\^(\w))*/$self->get_data(\$rec,$1,$2,$i,\$found)/ges; if ($found) { + if ($eval_code) { + my $eval = $self->fill_in($rec,$eval_code,$i); + return if (! eval $eval); + } # do we have lookups? if ($format =~ /\[[^\[\]]+\]/o) { return $self->lookup($format); @@ -355,12 +363,12 @@ my $prefix; my $all_found=0; -print "## $format\n"; +#print "## $format\n"; while ($format =~ s/^(.*?)v(\d+)(?:\^(\w))*//s) { -print "## [ $1 | $2 | $3 ] $format\n"; +#print "## [ $1 | $2 | $3 ] $format\n"; my $del = $1 || ''; - $prefix ||= $del; + $prefix ||= $del if ($all_found == 0); my $found = 0; my $tmp = $self->get_data(\$rec,$2,$3,$i,\$found); @@ -374,13 +382,16 @@ return if (! $all_found); - print Dumper($prefix, \@out); - my $out = join('',@out) . $format; # add prefix if not there $out = $prefix . $out if ($out !~ m/^\Q$prefix\E/); + if ($eval_code) { + my $eval = $self->fill_in($rec,$eval_code,$i); + return if (! eval $eval); + } + return $out; }