I'm using Bot::BasicBot
to write a bot that logs chat. I have a config hashref that looks like this:
my $config = {
cryptokey => "a" x 32,
nickpass => "password",
nick => "loggerbot",
server => 'irc.foonetic.net',
port => 6697,
ssl => 1
};
I have a separate config file that I use to read custom options into the hashref. I have tested it, and they read in correctly. However, when I add the items into the constructor
LogBot->new(
server => $config->{server},
port => $config->{port},
ssl => $config->{ssl},
channels => ["#test"],
nick => "$config->{nick}",
username => "loggerbot",
quit_message => "shutting down"
)->run();
The bot does not connect or even time out. It works if I omit the variables and just put the values directly in. What am I doing wrong?
I figured it out using Data::Dumper
. It turned out I forgot to chomp each line as I was reading in the config file, so the variables had newlines at the end.