home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / perl / 7021 < prev    next >
Encoding:
Internet Message Format  |  1992-11-17  |  1.3 KB

  1. Path: sparky!uunet!portal!lll-winken!fnnews.fnal.gov!mp.cs.niu.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!chappell
  2. From: chappell@symcom.math.uiuc.edu (Glenn Chappell)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: Calling a text editor from Perl
  5. Message-ID: <BxvEyu.585@news.cso.uiuc.edu>
  6. Date: 17 Nov 92 17:23:14 GMT
  7. References: <Bxtyon.H0x@cs.uiuc.edu>
  8. Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
  9. Reply-To: chappell@math.uiuc.edu (Glenn Chappell)
  10. Organization: Math Dept., University of Illinois at Urbana/Champaign
  11. Lines: 21
  12.  
  13. In article <Bxtyon.H0x@cs.uiuc.edu> schwager@cs.uiuc.edu writes:
  14. >
  15. >Hi,
  16. >Is it possible to call a text editor from Perl?  I want to do something
  17. >like this:
  18. >        `/usr/ucb/vi /tmp/addgr$$`;
  19. >but it looks like the terminal i/o is not working properly, so it just
  20. >hangs at that statement.  Afterwards I have to reset my terminal, so I'm sure
  21. >it's scrogged somehow.  Thanks for any help.  I'd hate to have to go back to
  22. >using csh.
  23. >
  24. >I'm on a Sun Sparc, running os 4.1.2, and the latest Perl.
  25.  
  26. I had (what I think is) the same problem. It turned out to be because vi
  27. was taking its input from the STDIN of the Perl script, and not from the
  28. terminal. My solution was to tell it to get its input from /dev/tty,
  29. e.g.
  30.  
  31. system "/usr/ucb/vi /tmp/addgr$$ < /dev/tty";
  32.  
  33.                 GGC  <><
  34.