in reply to Capturing output from Child processes
From the "Caveats and limitations" section of perlipc (AS 5.8 html).
Forking pipe open() not yet implemented
The open(FOO, "|-") and open(BAR, "-|") constructs are not yet implemented. This limitation can be easily worked around in new code by creating a pipe explicitly. The following example shows how to write to a forked child: ...
The error message you are seeing is because '-' is being passed to CMD as a command, and it isn't:).
It would be nice if this unimplemented feature of perl actually issued a "Unimplemented feature" warning wouldn't it.
However, the above quote goes on to show a reasonably simply way of emulating the feature under Win32. Makes me wonder why, if it's so easy to emulate, why it isn't done for us, but there's probably a good reason.
Update: The appears to be a bug in the sample code given for the pipe_from_fork() emulation. Using AS 5.8, it didn't work for me until I added close STDOUT; just before the open( STDOUT, ">&="... in the else clause.
Anyone know if there is an easy method of reporting such documentation bugs? Should this go to AS or P5P?
One additional caveat. Remember that unlike 'ls' on *nix, 'dir' is not an executable but a builtin-in command of the shell, so it's not a good candidate for testing with. You need some other command that is an executable that produces output to stdout for this purpose.
|
|---|