lookup_key and lookup_val types now support filters
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 5 Mar 2004 23:33:19 +0000 (23:33 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 5 Mar 2004 23:33:19 +0000 (23:33 +0000)
git-svn-id: file:///home/dpavlin/private/svn/webpac/trunk@233 13eb9ef6-21d5-0310-b721-a9d68796d827

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'?";
                                                }