zentara has asked for the wisdom of the Perl Monks concerning the following question:

I saw this question in a programming newsgroup, and was wondering if perl could do it.

The question was how to open another xterm, and write to it, instead of the originating xterm. This was in c. The poster finally posted this summary of how to do it in c, but it's beyond me. Can this be done in perl?

1. in main program:
   openpty() and note the master and slave. I don't care about the
   other params right now.
2. in main program:
    fork()
3. in child:
    execl xterm with -Sxx<slave-fd>
4. in parent:
   write to master fd.
And "magically" data appears on the xterm!

So I guess the question is can you open another pty, and write to it like it was a filehandle?

Replies are listed 'Best First'.
•Re: opening and writing to another xterm
by merlyn (Sage) on Oct 13, 2002 at 15:43 UTC
    So I guess the question is can you open another pty, and write to it like it was a filehandle?
    I'd imagine that's precisely what IO::Pty lets you do, although you might be happier with the Expect interface for it.

    -- Randal L. Schwartz, Perl hacker