in reply to DBI mysql slow queries, hanging threads

To catch the signal see Perl FAQ 4.9

$SIG{'INT'} = 'CLEANUP'; sub CLEANUP { print "\n\nCaught Interrupt (^C), Aborting\n"; exit(1); }

You may also want to catch other signals like KILL, TERM, STOP, QUIT, HUP depending on your OS. I would catch at least INT, KILL and TERM by default.

$SIG{$_} = 'CLEANUP' for qw(INT KILL TERM STOP QUIT);