in reply to Returning through signal
When you install a signal handler for SIGINT, the process won't terminate unless you request it explicitly (i.e. using exit).
Try this:
#!/usr/bin/perl -w use strict; my $interrupted = 0; sub handler { $interrupted = 1; } $SIG{INT} = \&handler; print "Sleeping, feel free to interrupt (normally ^C)\n"; sleep(10); print "Done, "; print $interrupted ? "interrupted" : "without interruptions", ".\n";
Pressing ^C causes sleep to return earlier, but it does not end the process.
-- TMTOWTDI
|
|---|