Changeset 813
- Timestamp:
- 1999-12-07T10:49:15+13:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/cfgread.pm
r537 r813 71 71 72 72 73 # stringexp and arrayexp should be something like74 # 73 # stringexp, arrayexp, hashexp and arrayarrayexp 74 # should be something like '^(this|that)$' 75 75 sub read_cfg_file { 76 my ($filename, $stringexp, $arrayexp, $hashexp ) = @_;76 my ($filename, $stringexp, $arrayexp, $hashexp, $arrayarrayexp) = @_; 77 77 my ($line); 78 78 my $data = {}; … … 92 92 my $v = shift @$line; 93 93 $data->{$key}->{$k} = $v; 94 } elsif (defined $arrayarrayexp && $key =~ /$arrayarrayexp/) { 95 if (!defined $data->{$key}) { 96 $data->{$key} = []; 97 } 98 push (@{$data->{$key}}, $line); 94 99 } 95 100 } … … 104 109 105 110 106 # stringexp and arrayexp should be something like107 # 111 # stringexp, arrayexp, hashexp and arrayarrayexp 112 # should be something like '^(this|that)$' 108 113 sub write_cfg_file { 109 my ($filename, $data, $stringexp, $arrayexp, $hashexp ) = @_;110 114 my ($filename, $data, $stringexp, $arrayexp, $hashexp, $arrayarrayexp) = @_; 115 111 116 if (open (COLCFG, ">$filename")) { 112 117 foreach $key (sort(keys(%$data))) { … … 118 123 foreach $k (keys (%{$data->{$key}})) { 119 124 &write_cfg_line ('COLCFG', [$key, $k, $data->{$key}->{$k}]); 125 } 126 } elsif ($key =~ /$arrayarrayexp/) { 127 foreach $k (@{$data->{$key}}) { 128 &write_cfg_line ('COLCFG', [$key, @$k]); 120 129 } 121 130 }
Note:
See TracChangeset
for help on using the changeset viewer.