> 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? > > [SNIP CODE] >
You want to do that differently, try: while (1) { eval { local $SIG{INT} = sub { die "Interrupt\n" }; sleep 5; }; if ($@) { die $@ if $@ ne "Interrupt\n"; print "Interrupted output\n"; } # Normal stuff } Jonathan Paton __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]