git.p6c8.net
/
devedit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- Allow to use Greenwich Mean Time in date strings (maybe someone needs it)
[devedit.git]
/
modules
/
Config
/
DevEdit.pm
diff --git
a/modules/Config/DevEdit.pm
b/modules/Config/DevEdit.pm
index 9b3cc6c1e560e3b06e3fa763c840ebb58217225f..7402ff19361a15a0089e2b5491967067e214d36b 100644
(file)
--- a/
modules/Config/DevEdit.pm
+++ b/
modules/Config/DevEdit.pm
@@
-6,7
+6,7
@@
package Config::DevEdit;
# Read and parse the configuration files
#
# Author: Patrick Canterino <patrick@patshaping.de>
# Read and parse the configuration files
#
# Author: Patrick Canterino <patrick@patshaping.de>
-# Last modified: 200
4-12-31
+# Last modified: 200
5-01-06
#
use strict;
#
use strict;
@@
-53,17
+53,20
@@
sub parse_config($)
my $file = shift;
local *CF;
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 = {};
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)
{
foreach my $line(@lines)
{
+ $count++;
+
next if($line =~ /^\s*#/);
next if($line =~ /^\s*#/);
- next if($line !~ /^\s*\S+\s*=.
+
$/);
+ next if($line !~ /^\s*\S+\s*=.
*
$/);
my ($key,$value) = split(/=/,$line,2);
my ($key,$value) = split(/=/,$line,2);
@@
-74,7
+77,7
@@
sub parse_config($)
$value =~ s/^\s+//g;
$value =~ s/\s+$//g;
$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;
}
$config->{$key} = $value;
}
patrick-canterino.de