Release 0.01
[usenet/newsstats.git] / NewsStats.pm
index 1d07be6..a237774 100644 (file)
@@ -2,7 +2,7 @@
 #
 # Library functions for the NewsStats package.
 #
-# Copyright (c) 2010-2012 Thomas Hochstein <thh@inter.net>
+# Copyright (c) 2010-2013 Thomas Hochstein <thh@inter.net>
 #
 # This module can be redistributed and/or modified under the same terms under 
 # which Perl itself is published.
@@ -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;
 };
 ################################################################################
 
This page took 0.010798 seconds and 4 git commands to generate.