in reply to Why this daemon can only receive the HUP signal no more than one time?
I haven't tested any code, but it always looks like a red flag to me if there is significantly more stuff than variable assignment inside a signal handler. In doSigHup() you are doing the whole relaunch inside a signal handler sub. I would try to call relaunch() from the main loop in hupMain(). doSigHup() would just set a global variable (e.g. $do_relaunch = 1) which must be checked in the main loop.