in reply to Signal Trapping..help please
Check out perldoc perlipc. To catch an interrupt signal:
$SIG{INT} = sub { # handle the interrupt }
You can test it with this:
my $count = 0; $SIG{INT} = sub { print "\nCaught an interrupt\n"; exit if $count++ > 2 }; $|++; while (1) {print '.'; sleep 1}
Edit: Of course, as zaxo pointed out below, since you are simply looking at gracefully disconnecting from the database, you probably don't need the signal handler.
Cheers,
Ovid
New address of my CGI Course.
|
|---|