-----Original Message----- From: Jeff Pang [mailto:[EMAIL PROTECTED] Sent: Thursday, October 19, 2006 2:10 AM To: Helliwell, Kim; beginners@perl.org Subject: Re: Non-blocking child process
Hello, I changed your codes like below: use strict; for (my $i=0;$i<2;++$i) { my $pid = open CHILD,"|-"; select CHILD;$|++;select STDOUT; if ($pid) { print CHILD "/etc/passwd"; }else { my $c = <>; exec "/bin/cat $c"; } } __END__ The parent doesn't get blocked when it finished writing to the childs.It is that,when the parent finished the "print CHILD",it should continue for the next loop,while the childs should do the things they wanted.The childs can't block the parent except that they must read lots of datas from parent then it maybe slow the parent's writting action (due to the buffer). __END__ Jeff: Thanks for taking the time to look at this. I don't think this is the answer I need, however. If I use cat from the child process, the parent gets control as soon as cat exits, which it does when it reaches end-of-file. In my case, I'm launching xgraph from the child, which doesn't exit until the user click the close button. In that case, the parent blocks until the close button is clicked. I would like the parent to continue independently of the child. Kim Helliwell LSI Logic Corporation Work: 408 433 8475 Cell: 408 832 5365 [EMAIL PROTECTED]