Changeset 813 for trunk


Ignore:
Timestamp:
1999-12-07T10:49:15+13:00 (24 years ago)
Author:
sjboddie
Message:

plugins now take options and classifiers are handled properly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/cfgread.pm

    r537 r813  
    7171
    7272
    73 # stringexp and arrayexp should be something like
    74 #   '^(this|that)$'
     73# stringexp, arrayexp, hashexp and arrayarrayexp
     74# should be something like '^(this|that)$'
    7575sub read_cfg_file {
    76     my ($filename, $stringexp, $arrayexp, $hashexp) = @_;
     76    my ($filename, $stringexp, $arrayexp, $hashexp, $arrayarrayexp) = @_;
    7777    my ($line);
    7878    my $data = {};
     
    9292            my $v = shift @$line;
    9393            $data->{$key}->{$k} = $v;
     94        } elsif (defined $arrayarrayexp && $key =~ /$arrayarrayexp/) {
     95            if (!defined $data->{$key}) {
     96            $data->{$key} = [];
     97            }
     98            push (@{$data->{$key}}, $line);
    9499        }
    95100        }
     
    104109
    105110
    106 # stringexp and arrayexp should be something like
    107 #   '^(this|that)$'
     111# stringexp, arrayexp, hashexp and arrayarrayexp
     112# should be something like '^(this|that)$'
    108113sub write_cfg_file {
    109     my ($filename, $data, $stringexp, $arrayexp, $hashexp) = @_;
    110 
     114    my ($filename, $data, $stringexp, $arrayexp, $hashexp, $arrayarrayexp) = @_;
     115   
    111116    if (open (COLCFG, ">$filename")) {
    112117    foreach $key (sort(keys(%$data))) {
     
    118123        foreach $k (keys (%{$data->{$key}})) {
    119124            &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]);
    120129        }
    121130        }
Note: See TracChangeset for help on using the changeset viewer.