open(PIPE,"| command |") -- pipe & fork? 
Author Message
 open(PIPE,"| command |") -- pipe & fork?

Camel, P. 163: "You may not have an open command that pipes both in and
out, though it's easy to build one using the pipe and fork commands"

There's no example of how to do this!  Can someone post an example?  I
want something like:
open(DOIT,"| command1 | command2 | command3 | command4 | command5 |");

I've seen this question asked before, but didn't have a reason to read
it, so I apologize :)

[I'm using 4.036, but a Perl 5 solution (if different) would be welcome too]

--
============================================================================

--------------------------------------+-------------------------------------
   It's a small world, but I wouldn't want to paint it...
                                              - Steven Wright
============================================================================



Thu, 19 Mar 1998 03:00:00 GMT  
 open(PIPE,"| command |") -- pipe & fork?

Matt> Camel, P. 163: "You may not have an open command that pipes both in and
Matt> out, though it's easy to build one using the pipe and fork commands"

Matt> There's no example of how to do this!  Can someone post an example?  I
Matt> want something like:
Matt> open(DOIT,"| command1 | command2 | command3 | command4 | command5 |");

I believe the answer from the FAQ is "see open2.pl and open3.pl, in
the library".

Why do you think we have a FAQ? :-)

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)

--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying

Web: <A HREF="http://www.teleport.com/~merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me



Thu, 19 Mar 1998 03:00:00 GMT  
 open(PIPE,"| command |") -- pipe & fork?
 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc,

:Camel, P. 163: "You may not have an open command that pipes both in and
:out, though it's easy to build one using the pipe and fork commands"
:
:There's no example of how to do this!  Can someone post an example?  

That's a FAQ, http://www.perl.com/perl/faq/Q5.14.html to be precise.

--tom
--

People who deal with bits should expect to get bitten. --Jon Bentley



Fri, 20 Mar 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. "open" pipe with stderr

2. Problem with an unexpected "broken pipe"

3. IO::Socket "Broken pipe" crashes script

4. "Access denied" with Win32::Pipe

5. "Broken pipe"

6. Closing pipes results in "uninitialized value"

7. Troubles "perl"ifying a shellscript that uses pipes

8. Help reading pipes "unbuffered"?

9. "pipe" code - mail- e-mail

10. Piping in stderr when creating a pipe with the open call

11. SIGPIPE and open("| command")

12. Command not found when opening "-|"

 

 
Powered by phpBB® Forum Software