X-Git-Url: https://git.p6c8.net/devedit.git/blobdiff_plain/0577a1ece82df55f43840d9187fd5b150ec25361..f9c7f7df804b1e362de3e8385f95b82fc1210ad7:/modules/Config/DevEdit.pm diff --git a/modules/Config/DevEdit.pm b/modules/Config/DevEdit.pm index 0286f5a..7402ff1 100644 --- a/modules/Config/DevEdit.pm +++ b/modules/Config/DevEdit.pm @@ -5,8 +5,8 @@ package Config::DevEdit; # # Read and parse the configuration files # -# Author: Patrick Canterino -# Last modified: 2004-11-24 +# Author: Patrick Canterino +# Last modified: 2005-01-06 # use strict; @@ -53,17 +53,20 @@ sub parse_config($) my $file = shift; local *CF; - open(CF,"<".$file) or croak("Open $file: $!"); + open(CF,'<'.$file) or croak("Open $file: $!"); read(CF, my $data, -s $file); close(CF); my @lines = split(/\015\012|\012|\015/,$data); my $config = {}; + my $count = 0; foreach my $line(@lines) { + $count++; + next if($line =~ /^\s*#/); - next if($line !~ /^.+=.+$/); + next if($line !~ /^\s*\S+\s*=.*$/); my ($key,$value) = split(/=/,$line,2); @@ -74,7 +77,7 @@ sub parse_config($) $value =~ s/^\s+//g; $value =~ s/\s+$//g; - croak "Double defined value '$key' in configuration file '$file'" if($config->{$key}); + croak "Configuration option '$key' defined twice in line $count of configuration file '$file'" if($config->{$key}); $config->{$key} = $value; }