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

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

I've got a POE::Component::IRC bot with some loops that cause it to pause. This is a POE FAQ which I've read many times along with the other docs and tried to implement to no avail. These subs handle private IRC messages, and "do_help" is where the program pauses. I appreciate any assistance you can offer in using yield to handle simultaneous requests.
# HANDLES PRIVATE MSG sub irc_msg { my $kernel = $_[KERNEL]; my $nick = (split /!/, $_[ARG0])[0]; my $msg = $_[ARG2]; my $say = process_msg($kernel, $nick, $msg); if ($say) { $kernel->post($bot, 'privmsg', $nick, $say); } } # PROCESSES PRIVATE MSG sub process_msg { my ($kernel,$nick,$arg) = @_; if ($arg =~ /^help/) { do_help($kernel,$nick) } } # PRINTS BOT HELP sub do_help { my ($kernel,$nick) = @_; my @help = ( "This array has many lines..", ); for (@help) { # BOT PAUSES TO COMPLETE THIS LOOP $kernel->post($bot, 'privmsg', $nick, $_); } }

--
perl -MO=Deparse -e"u j t S n a t o e h r , e p l r a h k c r e"