Hi All,
I want to write a simple perl script to start an endless loop (for reading
data from a periphery device, such as a measurement unit), but I also want
to be able to stop it anytime. Right now I use "Ctrl-Alt-Del" to do it.
There must be a better way. I has been trying to use open, pipe...not seem
to understand how to use them.
You could create a file on the filesystem (call it, say, 'STOP') and test for the file's existence in the loop.
You could use a signal:
# call-back for signal INT (Control-C)
sub got_kill
{
$kill_flag = 1;
}
# call-back for signal BREAK (Control-Break)
sub got_break
{
$kill_flag = 1;
}
$SIG{INT} = \&got_kill;
$SIG{BREAK} = \&got_break;
--
HTH
pDale Campbell
"Elvis, are you out there somewhere?"
_______________________________________________ Perl-Win32-Users mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
