in reply to Re^4: CHLD handler stopped working
in thread CHLD handler stopped working
Using return was a suggestion.
I wrote:
Having said that, I recommend you read what exit says about exiting from subroutines. Even if the simple fix I described above works for you now, when you next add a little more "complexiy" you may find yourself with problems again. Perhaps you could return with the child PID instead of using exit; then, if the end of &multi_dir is reached, return with zero — that way, you can test the return value of multi_dir() and exit if it's the child or continue with the main script if it's the parent. Here's an example:
Assuming you read the exit doco, you now need to make a decision about whether any of the reasons for not using exit in a subroutine apply to you.
-- Ken
|
|---|