I have a script that waits for user input, and prints info based on the
info. The print info part sometimes takes a long time.
I want to capture the INT signal (^C) but depending on if I am waiting for
input or printing something I want (^C) to act differently.
This program loops endlessly, waiting for input and printing out until the
user types 'quit'.
I tried this...works the first time but it doesn't work the second time I
type (^C). Is there something I have to do to flush/reset the signal?
### start code
[snip]
sub wait4input {
$SIG{INT} = \&exiting; ## the subroutine just has exit; in it basically
print "\n\nType 'help' for explaination.\nEnter a file\n";
print "? ";
while(<>){
$SIG{INT} = \&wait4input;
[snip rest of while]
$SIG{INT} = \&exiting;
} # end of while
} # end of wait4input
__END__
Nikola Janceski
To read without reflecting, is like eating without digesting.
-- Francis Bacon
----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]