Commit 1ed03639 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

* Made old and new Config::IniFiles work

parent ffe93bc2
......@@ -72,7 +72,8 @@ tie my %inifile, 'Config::IniFiles', (
) or die "Failed to open config file '".$cfg->{'config_file'}."': $!";
# Copy config
my %config = %inifile;
untie(%inifile);
# FIXME: This now generates a warning as Config::Inifiles doesn't implement UNTIE
# untie(%inifile);
# Our fake server...
......@@ -141,12 +142,22 @@ sub loadModules
# Pull in module list
my $modules = $config{'server'}{'modules'};
my @modulelist;
foreach my $module (@{$modules}) {
$module =~ s/\s+//g;
# Skip comments
next if ($module =~ /^#/);
$module = "modules/$module";
push(@modulelist,$module);
if (ref($config{'server'}{'modules'}) eq "ARRAY") {
foreach my $module (@{$modules}) {
$module =~ s/\s+//g;
# Skip comments
next if ($module =~ /^#/);
$module = "modules/$module";
push(@modulelist,$module);
}
} else {
my @splitModules = split(/\s+/,$config{'server'}{'modules'});
foreach my $module (@splitModules) {
# Skip comments
next if ($module =~ /^#/);
$module = "modules/$module";
push(@modulelist,$module);
}
}
# Emulate server
......
......@@ -146,22 +146,42 @@ sub configure {
die "Server configuration error: 'protocols' not found";
}
# Split off modules
my @moduleList = split(/\s+/,$config{'server'}{'modules'});
foreach my $module (@moduleList) {
# Skip comments
next if ($module =~ /^#/);
$module = "modules/$module";
push(@{$cfg->{'module_list'}},$module);
if (ref($config{'server'}{'modules'}) eq "ARRAY") {
foreach my $module (@{$config{'server'}{'modules'}}) {
$module =~ s/\s+//g;
# Skip comments
next if ($module =~ /^#/);
$module = "modules/$module";
push(@{$cfg->{'module_list'}},$module);
}
} else {
my @moduleList = split(/\s+/,$config{'server'}{'modules'});
foreach my $module (@moduleList) {
# Skip comments
next if ($module =~ /^#/);
$module = "modules/$module";
push(@{$cfg->{'module_list'}},$module);
}
}
# Split off protocols
my @protocolList = split(/\s+/,$config{'server'}{'protocols'});
foreach my $module (@protocolList) {
# Skip comments
next if ($module =~ /^#/);
$module = "protocols/$module";
push(@{$cfg->{'module_list'}},$module);
}
if (ref($config{'server'}{'protocols'}) eq "ARRAY") {
foreach my $module (@{$config{'server'}{'protocols'}}) {
$module =~ s/\s+//g;
# Skip comments
next if ($module =~ /^#/);
$module = "protocols/$module";
push(@{$cfg->{'module_list'}},$module);
}
} else {
my @protocolList = split(/\s+/,$config{'server'}{'protocols'});
foreach my $module (@protocolList) {
# Skip comments
next if ($module =~ /^#/);
$module = "protocols/$module";
push(@{$cfg->{'module_list'}},$module);
}
}
# Override
if ($cmdline->{'debug'}) {
$server->{'log_level'} = 4;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment