http://qs321.pair.com?node_id=1138295

GodEater has asked for the wisdom of the Perl Monks concerning the following question:

I've been tasked with writing an IRC bot which will join channels on the internal IRC system here, and post messages to channels which don't appear to be used anymore, warning any potential users that the channel is about to be retired. Our IRC system has about 6,500 channels which need these messages posted to them, and the IRC server we use (a customised fork of Hybrid) limits concurrent channel joins to 100 per connection. In an attempt not to hit this limit, the code I've got is this :

if ($channel_list->{$channel}{joined}) { # If we're already joined, privmsg immediately $logger->info("Trying to message $channel"); $data_entry->notified('true'); $data_entry->update; $irc->yield(privmsg => $msg_channel, $message); $irc->yield(part => $msg_channel); } else { # Otherwise join, and let the join event do the privmsg $logger->info("Trying to join $channel"); $data_entry->notified('true'); $data_entry->update; $irc->yield(join => $msg_channel); }

i.e. it will see if we're joined already, and if we are, try to post the notification message, and then immediately part. If we're not joined, it tries to join first (and the join event will fire the message sending).

The problem is the code never seems to run the

$irc->yield(part => $msg_channel);

line, as eventually I start getting irc_405 events back from the IRC server saying the code has joined too many channels. Anyone got any idea what am I doing wrong?