home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / perl / 4893 < prev    next >
Encoding:
Text File  |  1992-07-22  |  1.4 KB  |  47 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!gossip.pyramid.com!decwrl!concert!rock!fletcher!mcmahan
  3. From: mcmahan@cs.unca.edu (Scott McMahan -- Genesis mailing list owner)
  4. Subject: Process question...
  5. Message-ID: <1992Jul22.231637.23043@cs.unca.edu>
  6. Organization: University of North Carolina at Asheville
  7. X-Newsreader: Tin 1.1 PL3
  8. Date: Wed, 22 Jul 1992 23:16:37 GMT
  9. Lines: 36
  10.  
  11. This has stumped me.
  12.  
  13. I want to fork off a process, but be able to read the forked 
  14. processes' stdout in the parent, as well as feed the forked process
  15. stdin from the parent. Preferably an execed process. :)
  16.  
  17. ________________
  18. | main  ^    V |
  19. ________|____|_|
  20.        ?|   ?|         stdin   __________________
  21.         |    |---------------->| forked process |
  22.         |                      -----V------------
  23.         |<--------------------------| stdout
  24.  
  25. How to do this in perl has baffled me, and I don't see it in the FAQ. 
  26. I suspect there's some kind of file or pipe involved, but beyond that
  27. I'm lost.
  28.  
  29. Luckily there are people on this newsgroup who've forgotten more about
  30. Perl than I'll ever know!
  31.  
  32. Maybe an example would help...
  33.  
  34. fork a process that will exec 'sort'
  35. parent feeds sort a bunch of words, and reads sort's output for use later.
  36.  
  37. (I know you can sort in perl, it's just an example! :))
  38.  
  39. or
  40.  
  41. fork and exec inews
  42. feed it a post
  43. read the output and decide whether to bother a human about it
  44.  
  45. Scott
  46.  
  47.