in reply to Any reference about %SIG

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.