in reply to Re^2: Process Management
in thread Process Management

That's interesting. So is your point that this is a case where one should check if the return is defined (and not just "true"), or does there need to be a third branch to handle the "0"?

Neither the examples in perlipc or in the Perl Cookbook make any attempt at special handling of a return of "0".

Replies are listed 'Best First'.
Re^4: Process Management
by gwadej (Chaplain) on Jan 19, 2009 at 14:27 UTC

    My point is that there are actually three cases that need to be dealt with. Since fork almost never fails, people often forget the undef case and just handle true as parent and false as child.

    I like handling them as three separate cases, because the parent may be able to recover.

    In any case where the parent continues, handling the undef is important. Otherwise, you end up with a subtle, hard to reproduce bug.

    G. Wade