Hi all.
To circumvent this ( hopefully temporary ) shortcoming,
I usually just write the signal handler in this fashion:
#!c:\perl\perl.exe -w
use strict;
my $num = 5;
$| = 1;
$SIG{ 'INT' } = \&stop;
while( $num )
{
print "I'm waiting...\n";
sleep 2;
}
sub stop
{
$SIG{ 'INT' } = \&stop;
$num--;
print "$num\n";
}
You have to override the signal handler on win32 machines
because after the signal handler is called, it's value
( which is stored in %SIG ), will revert back to the default. Since 'Control-c' is the same as SIG{ 'INT' }, the program will stop executing immediately.
Hope this helps,
-Katie.