in reply to signal handler on NT

As fglock said, the die() inside the sub is causing ActiveState's version to cause Windows errors (at least for me..though I did originally get the signal trap message). So I used the $saw_sig var in your code to tell it when to die:
#!/usr/bin/perl $saw_sig = 0; $SIG{INT} = \&my_sig; sub my_sig{ print "I am catching the signals\n"; $saw_sig = 1; } while (1){ $saw_sig==0?print "I am here\n":die; }

Replies are listed 'Best First'.
Re^2: signal handler on NT
by Aristotle (Chancellor) on Sep 17, 2002 at 21:37 UTC
    In fact, for the reasons BrowserUk posted and more (similar caveats exist on almost all OSs), I'd do even less inside the signal handler:
    #!/usr/bin/perl -w use strict; my $got_int = 0; $SIG{INT} = sub { $got_int++ }; while (1){ print "Signal caught", exit if $got_int; print "I am here\n"; }
    Of course you can't always set up quite as minimalistic signal handlers, but don't use them for any more work than absolutely necessary.

    Makeshifts last the longest.