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"


In reply to Prevent POE IRC bot pause by epoptai

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.