From 63ecd7febf167ea4ef0adaf46ad69606e7916288 Mon Sep 17 00:00:00 2001 From: "Difrex(Denis Zheleztsov)" Date: Thu, 7 Aug 2014 22:34:23 +0400 Subject: [PATCH] Working config reload --- II/Config.pm | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/II/Config.pm b/II/Config.pm index 145963f..c6c89cd 100644 --- a/II/Config.pm +++ b/II/Config.pm @@ -5,10 +5,7 @@ use Config::Tiny; sub new { my $class = shift; - my $c = Config::Tiny->new(); - $c = Config::Tiny->read('config.ini'); - - my $self = { _config => $c, }; + my $self = { _file => 'config.ini', }; bless $self, $class; return $self; @@ -17,8 +14,11 @@ sub new { # Load configuration sub load { my ($self) = @_; - my $config = $self->{_config}; - + my $file = $self->{_file}; + + my $tiny = Config::Tiny->new(); + $config = $tiny->read($file); + my $key = $config->{auth}->{key}; my $nick = $config->{auth}->{nick}; my $host = $config->{node}->{host}; @@ -40,7 +40,10 @@ sub load { sub reload { my ($self) = @_; - return II::Config->load(); + my $c = II::Config->new(); + my $config = $c->load(); + + return $config; } 1;