in reply to forked kid can't read from IO::Select->can_read

i'm afraid your code is weird. who told you that opening a pipe forks to a new process, which then is under control by perl?
perldoc-f open says:
If the filename begins with '|', the filename is interpreted as a comm +and to which output is to be piped, and if the filename ends with a ' +|', the filename is interpreted as a command which pipes output to us +. See "Using open() for IPC" in perlipc for more examples of this.
the crucial words are: the filename is interpreted as a command to which output is to be piped - which means that the new process's control is up to the shell, and no longer to perl.
if you really want to fork to a process you can talk to, you will have to use one of the usual IPC methods. for convenience reasons i'd suggest you use sockets. but that's my personal opinion.

language is a virus from outer space.

Replies are listed 'Best First'.
Re^2: forked kid can't read from IO::Select->can_read
by Errto (Vicar) on May 22, 2005 at 15:07 UTC
    You might want to read open a bit more carefully. Further down it says,
    If you open a pipe on the command ’-’, i.e., either ’│-’ or ’-│’ with 2-arguments (or 1-argument) form of open(), then there is an implicit fork done, and the return value of open is the pid of the child within the parent process, and 0 within the child process. (Use "defined($pid)" to determine whether the open was successful.) The filehandle behaves normally for the parent, but i/o to that filehandle is piped from/to the STDOUT/STDIN of the child process. In the child process the filehandle isn’t opened--i/o happens from/to the new STDOUT or STDIN.
Re^2: forked kid can't read from IO::Select->can_read
by Anonymous Monk on May 22, 2005 at 13:05 UTC
    Hi thsoft,

    for here: perlipc.html#Safe-Pipe-Opens
    I took and changed:

    $pid = open(KID_TO_WRITE, "|-"); if ($pid) { # parent print KID_TO_WRITE @some_data; close(KID_TO_WRITE) || warn "kid exited $?"; } else { # child while (<STDIN>) { ... print ; # child's STDIN is parent's KID } exit; # don't forget this }
    So this shouldn't be the problem?