> -----Original Message-----
> From: Paul [mailto:ydbxmhc@;yahoo.com]
> Sent: Thursday, November 14, 2002 9:35 AM
> To: [EMAIL PROTECTED]
> Subject: RE: fork?
>
> ...
> if ($pid=fork()) { # I'm the parent
> # ... code
> } elsif (0 == $pid) { # I'm the child
> # ... code
> } else { # there was an error
> # ... code
> }
Minor point; this won't catch an error from fork(). If fork() fails, it
returns undef, and the test:
(0 == $pid)
Will be true, even if $pid is undef.
An alternate form is:
defined(my $pid = fork) or die "Couldn't fork: $!";
if ($pid) {
# child proceeds
...
exit; # child finished
}
# parent proceeds
...
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]