I am having a similar problem, and the advice I've been given on 
[EMAIL PROTECTED] is to look into using either IO::Pty or Expect.pm  I 
haven't had a chance to this, but apparently these modules can emulate a 
terminal.



At 08:04 AM 5/3/01 -0700, Dan Brown wrote:
>I don't think you're going to be able to do what you want to do.
>
>No terminal I know about accepts standard input (STDIN) as an argument.
>What I mean is that terminals are not like grep, sed, awk, sendmail, et
>al.  These programs all accept STDIN as an argument so you can pipe from
>grep to sed to awk to sendmail.  You cannot pipe something to a
>terminal.
>
>Now, in order to print to the terminal, you need to get the tty of the
>terminal you just opened.  Note that printing to the terminal is not
>like user input.  It's more like what /usr/bin/write does.  It just
>prints to the terminal it doesn't execute shell commands.
>
>To see what I mean, try this.  Have two terminals open.  In terminal 1
>enter
>
>         tty
>
>to get the tty.  Say, the results from the above tty were
>
>         /dev/pts/0
>
>In terminal 2, run this Perl script using
>
>         #!/usr/local/bin/perl
>         open( TERM, ">>/dev/pts/0" ) || die "Cannot open term [$!]";
>         print TERM "ls\n";
>         close( TERM );
>
>In terminal 1 you should see 'ls' followed by a new line.  But that's
>all. (at least all of this happened on my machine).
>
>I suppose you could run the 'ls' in the program and then send that
>information to terminal 1.
>
>         #!/usr/local/bin/perl
>         my $ls = `ls`;
>         open( TERM, ">>/dev/pts/0" ) || die "Cannot open term [$!]";
>         print TERM $ls;
>         close( TERM );
>
>Note this is not a Perl thing, it's a terminal thing.
>
>Of course, I'm not the definitive source on this.  If anyone on the list
>knows how to do this, please correct me.  I would find the solution very
>interesting.
>
>Sorry I couldn't have been of more help.
>
>Dan
>
>
>Martin McNelis wrote:
> >
> > Hi,
> >
> > I'm running Perl 5.6 on Solaris 2.6 and I'm having the following problem:
> >
> > #!/usr/local/bin/perl
> >
> > $pid = open (SCF, '|dtterm -name SCF');
> > sleep 10;
> > print SCF "ls\n";
> > close SCF;
> >
> > As you can see I'm trying to pipe input to dtterm, but nothing happens.
> >
> > Any help much appreciated,
> > Thanks,
> > Martin
> >
> > Martin McNelis
> > Software Test Engineer
> > Tecnomen Ltd.
> >
> > Phone: 061 - 702342
> > Mailto:[EMAIL PROTECTED]

Peter Cline
Inet Developer
New York Times Digital

Reply via email to