I have a perl module in which I am trying to do some clean up activity in the END block. But prior to do this cleanup activity, I would like to wait for all the child(ren) of the process using this Module.
So I did something like
Code:
END {
my $pid = wait;
#### Do the clean up stuff here
}
The issue I am facing here is that call to wait is setting up the status var ($?) to -1 in case there are no child of the current process. Which is in line with the definition of wait in man 2.
Is there a way I can ignore this setting of $? by wait ?