X-Git-Url: https://code.th-h.de/?p=usenet%2Fnewsstats.git;a=blobdiff_plain;f=NewsStats.pm;h=b462cd439c0505bb481c4e5783e9e60ea457c6cb;hp=1d07be6b976993db584446af16887f06dbb3f692;hb=25b25735dddfe027afe565a2e2ec78490a2cfa5e;hpb=38fa44f89b2f0a5dac65ef1b152aefebd5513c78 diff --git a/NewsStats.pm b/NewsStats.pm index 1d07be6..b462cd4 100644 --- a/NewsStats.pm +++ b/NewsStats.pm @@ -99,7 +99,19 @@ sub ReadConfig { ### IN : $ConfFile: config filename ### OUT: reference to a hash containing the configuration my ($ConfFile) = @_; - return Config::Auto::parse($ConfFile, format => 'equal'); + # mandatory configuration options + my @Mandatory = ('DBDriver','DBHost','DBUser','DBPw','DBDatabase', + 'DBTableRaw','DBTableGrps'); + # read config via Config::Auto + my $ConfR = Config::Auto::parse($ConfFile, format => 'equal'); + my %Conf = %{$ConfR}; + # check for mandatory options + foreach (@Mandatory) { + &Bleat(2,sprintf("Mandatory configuration option %s is not set!",$_)) + if (!defined($Conf{$_})); + } + # $Conf{'TLH'} is checked in gatherstats.pl + return $ConfR; }; ################################################################################