I am at best a part time perl sophmore and may be barking up the wrong tree, but...
I was hoping to "add" a network interface to some existing code. I found Net::Server (specifically Net::Server::Multiplex) and thought it'd be the perfect solution. I still suspect it may be but I'm stumped at the moment.

My fundamental issue is - how do I periodically get CPU cycles away from Net::Server to run my code? I assumed that what I needed to do was define "sub loop" and insert my code there, however this is either not the right answer or there is more to do.

So here's what I have (not sure if I should repost all the code here?). I started with samplechat.pl included with Net::Server. I added the following at the end:
sub loop { my ($self, @args) = @_; # sleep 1; print STDERR "Execute my code here...?\n"; $self->SUPER::loop(@args); }
My (most likely incorrect) assumption was that the net effect of this was to execute my code then "$self->SUPER::loop(@args);" would return control to the main loop. However The print statement is only executed once. Yet the chat server continues to run.

Anyone care to throw me a bone?

-- Thanks, Mike

In reply to How to use Net::Server by azmike

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.