The crudest way would be to check for the existence of a file periodically, and either pause or checkpoint the system when you see it.

Another slightly more refined way is to use a non-blocking socket, and check for data being present on the socket. Use another app to connect to the socket, and send control information. You don't need select() for this to work.

Probably the best way would be to use Win32::API, and hook some code that would poll the keyboard of the active process.

I suspect that the problem is dependant on the nature of the loop, the Perl compiler is not getting around to checking for I/O in certain types of loops. Under DOS, and to some extent Windows, keyboard I/O has to be checked for to receive a break signal. This is unlink Unix OS's, which send a signal to the process (DOS and Windows apps don't really have that concept, unless it's written into them).

--Chris

e-mail jcwren

In reply to (jcwren) RE: Win32 Interrupts by jcwren
in thread Win32 Interrupts by Adam

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.