2014-06-11 15:55:00 +04:00
|
|
|
package II::Config;
|
|
|
|
|
|
|
|
use Config::Tiny;
|
|
|
|
|
|
|
|
sub new {
|
|
|
|
my $class = shift;
|
|
|
|
|
|
|
|
my $c = Config::Tiny->new();
|
|
|
|
$c = Config::Tiny->read('config.ini');
|
|
|
|
|
|
|
|
my $self = { _config => $c, };
|
|
|
|
|
|
|
|
bless $self, $class;
|
|
|
|
return $self;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub load {
|
|
|
|
my ($self) = @_;
|
|
|
|
my $config = $self->{_config};
|
|
|
|
|
|
|
|
my $key = $config->{auth}->{key};
|
|
|
|
my $nick = $config->{auth}->{nick};
|
|
|
|
my $host = $config->{node}->{host};
|
|
|
|
my @echoareas = split /,/, $config->{node}->{echoareas};
|
2014-07-30 14:27:48 +04:00
|
|
|
my $name = $config->{node}->{name};
|
2014-06-11 15:55:00 +04:00
|
|
|
|
|
|
|
$c = {
|
|
|
|
nick => $nick,
|
|
|
|
key => $key,
|
|
|
|
host => $host,
|
|
|
|
echoareas => [@echoareas],
|
2014-07-30 14:27:48 +04:00
|
|
|
name => $name,
|
2014-06-11 15:55:00 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
return $c;
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|