in reply to Question about signals

Windows - I'm not sure there are any others.

Unix - ctrl-z produces something - SIGSTOP, I think. And "kill -1 $perl_pid" (from another shell) produces SIGHUP (a popular way of alerting daemons to re-read their config file), "kill -2 $perl_pid" (from another shell) produces SIGINT (same as ctrl-c), "kill -3 $perl_pid" ... etc. Anything else requires you to poll the keyboard for special keys, such as using Term::ReadKey:

use Term::ReadKey; ReadMode 4; if (my $key = ReadKey(-1) and $key = ' ') { # space was pressed close(INPUT_HANDLE); }
Just put something like that at various places in your loop, although if you're currently blocked on something else, this won't really help.

Replies are listed 'Best First'.
Re^2: Question about signals
by iKnowNothing (Scribe) on Jan 26, 2005 at 21:45 UTC
    Thanks for the info. I thought about using the Term::Readkey module. I think it will work for my purposes, but I have some other questions about it which I will post in another thread.