Re: Fundamental pipe questions



On Mar 30, 11:56 am, "Peter J. Holzer" <hjp-usen...@xxxxxx> wrote:
["Followup-To:" header set to comp.lang.perl.misc.]
On 2007-03-30 14:00, grocery_stocker <cdal...@xxxxxxxxx> wrote:

What's the difference between
open(FOO, "│tr ’[a-z]’ ’[A-Z]’");

How did you manage that? "│" is not a pipe ("|" is) and "’" is not a
single quote ("'" is). So that code will indeed not invoke a shell,
instead it will try to open the file "│tr ’[a-z]’ ’[A-Z]’" for reading.
But I'll assume that the strange characters were introduced by your
browser or google and that your real code does contain a pipe character
and single quotes.

and

open(FOO, ’│-’, "tr ’[a-z]’ ’[A-Z]’");

None.


If both constructs are the same, then how come perlipc rattles about
|-. I think the following section from perlipc comes to mind

And here’s a safe pipe open for writing:

# add error processing as above
$pid = open(KID_TO_WRITE, "|-");
$SIG{PIPE} = sub { die "whoops, $program pipe broke" };

if ($pid) { # parent
for (@data) {
print KID_TO_WRITE;
}
close(KID_TO_WRITE) || warn "kid exited $?";

} else { # child
($EUID, $EGID) = ($UID, $GID);
exec($program, @options, @args)
|| die "can’t exec program: $!";
# NOTREACHED
}





.



Relevant Pages

  • Re: Fundamental pipe questions
    ... single quote. ... browser or google and that your real code does contain a pipe character ... the strange characters were introduced by my browser. ...
    (comp.lang.perl.misc)
  • Re: Fundamental pipe questions
    ... single quote. ... the strange characters were introduced by my browser. ... about using |- for safe pipe opens. ...
    (comp.lang.perl.misc)