It turns out that this is one of the Things You Can't Do under Win32. Because of how Perl for win32 supports signals and forking (it doesn't, really -- see below) you have to go about it an alternate way. I suggest that you look at the Cookbook's recipe 17.13, "Non-forking servers." I've implemented several servers which had to work under Win32 for various reasons, and found it immensely useful. Unfortunatly, it tends to make the code go everywhere, but there's no easy way around that.

Win32's treating of signals is abysmal. The bottom line is that you might get killed at any second and there's not a damn thing you can do about it. END{} doesn't get called. %SIG is ignored. Because of this, your process must live in constant fear of its life. To top it off, until 5.6, you couldn't even create your own progeny. 5.6's implementation of fork(), though buggy, does work. But because signal handlers still don't work (like, say, SIGCHLD?) it's not much use.

As mentioned above, Win32::Process is the "equivalent" of fork. It's less useful because it's a seperate process entirely, though -- you don't even get a chance to give it your old varables (like, say, sockets..) So it isn't useful for servers..


--
perl -e 'print "Proud user of $^X$\"$]!$/";'


In reply to Re: SIGINT help by Chmrr
in thread SIGINT help by HaB

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.