On 10/05/2014 03:48, Uri Guttman wrote:
On 05/09/2014 04:58 PM, Shawn H Corey wrote:
On Fri, 09 May 2014 16:41:02 -0400
Harry Putnam <[email protected]> wrote:

As soon as I think I've got it right by thinking:

   ok, left side is into the command
      right side is out.

If I start pondering over that ... it begins to seem it is the other
way.

Gack.... I'm sick of it.

Agreed. I wished they used something like: ">|" and "<|"

they use - as that is also the magic name for stdio. in many unix tools
you can pass - as the filename (in or out) and the program will use the
appropriate i/o direction of stdio instead.

so it is an easy way to remember. |- has the pipe going out to the - so
that means stdout will be connected to the handle. -| has the - going in
to the pipe so that means stdin will be connected to the handle. and i
mean stdin/out of the process being forked. and you can't do both ways
as that would likely cause hanging with blocking i/o.

and if you want finer control, then use IPC::Open[23]

This is far from definitive, as there is no way of intuiting whether `-`
refers to the Perl program's STDIO or to the child process's. In fact

  open my $fh, '>-'

opens a handle to the Perl program's STDOUT, whereas

  open my $fh, '|-', 'command'

opens a handle to the child process's STDIN

So there is no consistency

Rob





---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to