>I'm not even sure the title is the appropriate terminology. What I am
>trying to do is fork a process that receives data from the parent, but,
>once the data is received, the parent can go on and do whatever it wants
>(and likewise the child). How do I arrange for the child process to be
>detached once the data is sent to it?
>

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).

--
Books below translated by me to Chinese.
Practical mod_perl: http://home.earthlink.net/~pangj/mod_perl/
Squid the Definitive Guide: http://home.earthlink.net/~pangj/squid/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to