"
...maybe someone will have a clue about how to do the clean-up of scripts left dangling by an escaping browser."
Well, do you know what causes them to "dangle"? Are they all waiting on a lock? If so,
tilly's node should provide a good solution to your problem; i.e., using LOCK_NB and retrying.
Alternatively, you can use alarm(). Signal handling is pretty reliable if you're careful; i.e., instead of dumping loads of potentially non-reentrant code into the handler itself, just set a flag and handle the condition in your main program.
--perlplexer