]> git.mjollnir.org Git - tks.git/commitdiff
Convert to using a simple INI file in the user's home directory for config, rather...
authorNigel McNie <nigel@catalyst.net.nz>
Mon, 26 May 2008 11:10:55 +0000 (23:10 +1200)
committerNigel McNie <nigel@catalyst.net.nz>
Mon, 26 May 2008 11:10:55 +0000 (23:10 +1200)
tks.pl

diff --git a/tks.pl b/tks.pl
index 36e02ba00d643b0eaf225edcbf786ea7bd248d05..8f1489d1f76fba7b8058e708cf048f8cd3e78a7e 100755 (executable)
--- a/tks.pl
+++ b/tks.pl
@@ -5,10 +5,11 @@ use warnings;
 use FindBin;
 use lib $FindBin::Bin . '/lib';
 use Getopt::Declare;
-use YAML;
+use Config::IniFiles;
 use WRMS;
 
-my $config = YAML::LoadFile($FindBin::Bin . '/config.yml');
+my %config;
+tie %config, 'Config::IniFiles', ( -file => $ENV{HOME} . '/.tksrc' );
 
 my $args = Getopt::Declare->new(q(
     [strict]
@@ -22,14 +23,14 @@ my @data = WRMS::load_timesheet_file($args->{'<file>'});
 
 # connect to wrms
 my $wrms    = WRMS->new({
-    username => $config->{username},
-    password => $config->{password},
-    site => $config->{site},
-    login => 1,
+    username => $config{default}{username},
+    password => $config{default}{password},
+    site     => $config{default}{site},
+    login    => 1,
 });
 
 # map of textual representations for WRs
-my $wrmap = $config->{wrmap};
+my $wrmap = $config{'wrmap'};
 
 my $total_time = 0;