I have looked over your code during the weekend. I understand the idea but not all the syntax though.
In our $TELNETS ||= 10;, what does " || " do?
And this: select undef, undef, undef, rand 1; ?
In $Q->enqueue( join( $, || '', @_ ) );, $ stands for the joining character and @_ is the arguments. But what is " || " and " '' " doing there?
I'm not lacy, just couldn't find that type of syntax in my Perl litterature. I have Perl CD bookshelf (E-book) and Perl-power (hardcopy) amongst other.

Other than that, it looks good. I have to inherit a skeleton class IO::Handle but leave the major methods blank. Hope telnet-socket only require writing to handle or this whole thing will not work easilly.
It will not work as good if telnet-socket is writing in char-by-char fashion instead of line-by-line. I can check that out later.

This is the behaviour I had in mind for the code your supplied:
I use the main (GUI) thread to create a tie to the thread::queue as you have done.
Main-thread starts a new telnet-thread and passes that tied queue. Telnet-thread creates a socket with logging to tied-filehandle. Then command-execution to the telnet-socket starts (and later ends) while logging occur.
Main-thread then starts a Update-thread that uses the tied-handle to save logging to file and calls a callback function that output the logging to the right GUI window.
For that to work, all the telnet threads must print tagged-messages to tied-handle so I can separate them in my Update()-thread and output them to the right file and window.

So my program will have.

Main-thread may start another telnet-thread when user gives some appropriate GUI command. (So they don't start at the same time). The number of telnet-threads is limited by the number of hardware access points.

This is not so different to your behaviour description and it looks promising. By the way, I got the message "A thread exited while 2 threads were running." while I ran your code. It was not an error so I was not to bad.
Thanks, for redirecting me. Hope it works out for me now :)


In reply to Re^6: Problem with using threads with modules. by tele2mag
in thread Problem with using threads with modules. by tele2mag

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.