From 147b25fc1aa8ed1501818e5918b69c8e4fe95c09 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 14 Nov 2004 22:39:13 +0000 Subject: handle empty environment better - we would whine when HOME is not set previously. --- Echolot/Config.pm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Echolot') diff --git a/Echolot/Config.pm b/Echolot/Config.pm index 147e98e..5ef4fda 100644 --- a/Echolot/Config.pm +++ b/Echolot/Config.pm @@ -68,15 +68,15 @@ sub init($) { die ("Basedir is not defined\n") unless defined $params->{'basedir'}; - my @CONFIG_FILES = - ( $ENV{'ECHOLOT_CONF'}, - $params->{'basedir'}.'/pingd.conf', - $ENV{'HOME'}.'/echolot/pingd.conf', - $ENV{'HOME'}.'/pingd.conf', - $ENV{'HOME'}.'/.pingd.conf', - '/etc/echolot/pingd.conf', - '/etc/pingd.conf' ); - + my @CONFIG_FILES = (); + push(@CONFIG_FILES, $ENV{'ECHOLOT_CONF'}) if defined $ENV{'ECHOLOT_CONF'}; + push(@CONFIG_FILES, $params->{'basedir'}.'/pingd.conf') if defined $params->{'basedir'}; + push(@CONFIG_FILES, $ENV{'HOME'}.'/echolot/pingd.conf') if defined $ENV{'HOME'}; + push(@CONFIG_FILES, $ENV{'HOME'}.'/pingd.conf') if defined $ENV{'HOME'}; + push(@CONFIG_FILES, $ENV{'HOME'}.'/.pingd.conf') if defined $ENV{'HOME'}; + push(@CONFIG_FILES, '/etc/echolot/pingd.conf'); + push(@CONFIG_FILES, '/etc/pingd.conf'); + my $DEFAULT; $DEFAULT = { # System Specific Options -- cgit v1.2.3