Hello exilepanda,

signals on windows are well summariazed here.

As far as I remember and also glancing the above module comment INT,QUIT,BREAK are handled in windows so you can use BREAK to do something else than die, I must have written some program using that signal to partially report a long running job status.

See also Catch-and-Handle-Signals-in-Perl by David Farrel (not windows specific tho).

Then Signals vs. Windows SIGHUP delivered on Windows Strawberry Perl and alarm() on Windows and sending signal to self with kill on windows. Recently I used $SIG{INT} and also some link in my Bibliotheca

A simple example to start: I run this infinite loop and pressed 3 times CTRL-BREAK and then CTRL-C to terminate it.

use strict; use warnings; my $growing_number; # Handle Ctrl-C $SIG{INT} = sub{ print "INT: last value of \$growing_number is: $growing_number\nTe +rminating..\n"; exit; }; # Handle Ctrl-Break $SIG{BREAK} = sub{ print "BREAK: Currently \$growing_number is: $growing_number\n"; }; while (1){ $growing_number += time; sleep 1; } __END__ BREAK: Currently $growing_number is: 10049615223 BREAK: Currently $growing_number is: 18424294603 BREAK: Currently $growing_number is: 23449102243 INT: last value of $growing_number is: 28473909892 Terminating..

L*

PS note also that if you put sleep 60 then the OS in question catch the signal every 60 seconds.. not so good. You can workaround it using sleep 1 for 1..60

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

In reply to Re: Any reference about %SIG -- windows by Discipulus
in thread Any reference about %SIG by exilepanda

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.