Actually, you can run more than one connection
with Net::IRC. Here is a minimal demonstration script:
#!/usr/bin/perl
use Net::IRC;
use strict;
my $server = "myserver";
my $irc = new Net::IRC;
my $conn1 = $irc->newconn(Nick => "test1",
Server => $server,
Port => 6667);
my $conn2 = $irc->newconn(Nick => "test2",
Server => $server,
Port => 6667);
$conn1->add_global_handler('msg', \&on_msg);
$conn2->add_global_handler('msg', \&on_msg);
$irc->start;
sub on_msg {
my ($self, $event) = @_;
my $who = $event->nick;
$self->privmsg($who, "hello, $who!!");
}
Send a message to either of the bots, and they'll reply. You can also add different handlers for each connection, and it'll do the right thing.
However, I don't know if this gets you a win or a lose as to open file handles overall...
Alan |