lookup_key and lookup_val types now support filters
[webpac] / all2xml.pl
index ad7f717..7157de0 100755 (executable)
@@ -342,11 +342,21 @@ sub data2xml {
                                                if ($lookup_key) {
                                                        print STDERR "WARNING: try to redefine lookup_key (keys shouldn't be repeatable fields!)";
                                                } else {
-                                                       $lookup_key = $display;
+                                                       if ($filter) {
+                                                               no strict 'refs';
+                                                               $lookup_key = &$filter($display);
+                                                       } else {
+                                                               $lookup_key = $display;
+                                                       }
                                                }
                                        } elsif (lc($x->{type}) eq "lookup_val") {
                                                if ($lookup_key) {
-                                                       $lhash{$lookup_key} = $display;
+                                                       if ($filter) {
+                                                               no strict 'refs';
+                                                               $lhash{$lookup_key} = &$filter($display);
+                                                       } else {
+                                                               $lhash{$lookup_key} = $display;
+                                                       }
                                                } else {
                                                        print STDERR "WARNING: no lookup_key defined for  '$display'?";
                                                }