- $prefix = "";
- } elsif ($format =~ s/^mfn//i) {
- $display .= $prefix . $row->{mfn};
- $prefix = "";
- } elsif ($format =~ s/^([^\d]+)(\d{0,3})/$2/) {
- $prefix .= $1 if ($display);
- } elsif ($format =~ s/^([^\d]+\d{0,2})//) {
- $prefix .= $1 if ($display);
- } elsif ($format =~ s/^(\d{1,2})//) {
- $prefix .= $1 if ($display);
+ }
+ push @fmt,'' if ($#fmt % 3 != 0); # add empty suffix
+ $cache->{format}->{$format} = \@fmt;
+
+# print STDERR "storing format for '$format': [",join("|",@fmt),"]\n";
+# print STDERR "storing format for '$format':",Dumper(@fmt),"\n";
+# print STDERR Dumper($cache->{format}->{$format});
+ }
+
+ # now produce actual record
+ my $tmp = $cache->{format}->{$format} || die "no format cache for '$format'";
+ my @fmt = @{$tmp};
+# print STDERR "using format for '$format':",Dumper(@fmt),"\n";
+# print STDERR "tmp ",Dumper($tmp);
+# print STDERR "cache: ",Dumper($cache->{format}->{$format});
+
+ # prefix
+ my $prefix = shift @fmt;
+ my $sufix;
+ while($#fmt > 1) {
+ my $f = shift @fmt || die "BUG: field name can't be empty!";
+ my $sf = shift @fmt;
+
+ if ($f eq 'mfn' && $i == 0) {
+ $display .= $sufix if ($display);
+ $display .= $row->{mfn};