log.pl
changeset 84 42d1df86ad05
parent 78 0d428ce0839a
child 90 4e18894dec80
--- a/log.pl	Sat Jan 03 22:47:10 2015 +0100
+++ b/log.pl	Mon Jan 05 10:53:48 2015 +0100
@@ -39,6 +39,7 @@
 use lib "/etc/logbuch";
 use config;
 
+
 # print @config::mailto, "\n";
 
 #+-------+---------------+------+-----+---------+----------------+
@@ -63,14 +64,18 @@
 my $MAGIC    = "#--- all changes below are ignored ---#\n";
 my $NODENAME = (split /\./, hostname)[0];
 
-my $opt_db      = $config::db // 1;
+package config {
+    # default values if not set in the config file
+    our $db //= 1;
+    our $logfile = "/root/LOG.$NODENAME";
+}
+
+my $opt_db      = $config::db;
 my $opt_mail    = 1;
 my $opt_message = "";
 my $opt_apt     = "";
 my $opt_initdir = "";
-my $opt_file    = defined $config::logfile    # use it twice
-  ? $config::logfile
-  : "/root/LOG.$NODENAME";
+my $opt_file    = $config::logfile;
 
 my $Dbh;