in reply to Re: why?
in thread why?

Well,I think you didn't know my meaning. I don't suspect fork() and pipe() can run well on activeperl (package 613). My trouble is parent can not have two children at the same time and one of the children are waiting for a filehandle! Thanks.

Replies are listed 'Best First'.
RE: RE: Re: why?
by chromatic (Archbishop) on May 05, 2000 at 19:24 UTC
    Oh, I see what you mean now.

    Forking works fine on ActivePerl 613 on NT, at least for me. The trouble is with the program flow. The first time through, you connect the parent's filehandles together. Fine. Then you fork off a child, let it keep the reader (and the parent the writer) and you send a message from parent to child. Child displays it, receives the EOF, and then exits. Perl closes the reader implicitly. The second time through, the parent uses pipe again, making another child. It then iterates through a hash of children, trying to send them messages.

    Unfortunately, the other end of the pipe connected to the first child is gone. That'll cause some trouble.

    Either close the writer at the end of the loop, or keep your children alive.