Please note that for backwards compatibility threading is not an option (especially with $VER <= perl 5.6). As pfaut also pointed out it's not always the best-option, anyways. The standards for threading aren't altogether clear, either, so I'd rather not use it as a production option for code that will be sent out. Therefore, I treat it much like an experimental function that's pretty far along in its development scale. (somewhere between lvalue and the builtins like open() I've come to trust) As you say "As demos, they are probably fine, but for real applications, this is extremely harmful, and makes absolutely no sense."

However, I prefer to use Net::Server with preforking when I need to create a server to do things. The module deals with a lot of the problems people will have (buffer overlflows, etc.) and is easily extensible. However, as the author asserts, it isn't as popular as the other server implementations (boohooo :O( ), and therefore needs users to write extensions and people to use it. I hope you, as well as other socket server people's try it; I've found it to be a great resource. (It might be interesting to write Net::Server::Threading, since threading is becomming more standardized as time goes on. Just make sure to use 5.8; in your code.)

I say give threading more time (maybe the next major realease of perl 5 and they'll hopefully be more usable in perl 6). Meanwhile IO::Select and fork() seem to provide viable production alternatives.

Gyan Kapur
gkapur@myrealbox.com

In reply to Re: Use thread with good care, but definitely keep using it by Revelation
in thread Use thread with good care, but definitely keep using it by pg

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.