Subject: | __DIE__ handler is not always correct |
I haven't tried the new MCE 1.5, but I've found the previous versions to be very useful. It's a very nice interface for running pool of workers. Thanks for that!
However, I think the way MCE handles exceptions from the children isn't entirely correct. It seems to rely on $^S to decide if the exception is going to be trapped or not. But that isn't very reliable. Observe:
$SIG{__DIE__} = sub { print $^S };
eval 'die'; # Prints 1
eval 'use BogusModule'; # Prints nothing
So if the MCE workers try to load a module that doesn't exist, then the child exits completely even if I wrap it all in eval.
perlvar advises against using $^S and suggests using an END block instead. I think that might be a more reliable (and natural) solution here.