delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/04/19/00:54:09

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Thu, 19 Apr 2001 12:53:45 +0800
From: Greg Matheson <lang AT ms DOT chinmin DOT edu DOT tw>
To: cygwin AT cygwin DOT com
Subject: perl Expect module can't open pty on cygwin
Message-ID: <20010419125345.A25777@ms.chinmin.edu.tw>
Mail-Followup-To: cygwin AT cygwin DOT com
Mime-Version: 1.0
User-Agent: Mutt/1.2.5i

I have installed the perl module, Expect.pm, so I can access
Expect functions from a perl script, rather than run an expect
script as a separate program. The module is working for
me on a FreeBSD system without privileges, but I am having
difficulty getting it working in cygwin. 

The problem seems to involve opening a pty. Stepping through
the Expect.pm code in the perl debugger on FreeBSD, we get:

main::(./down.pl:7):    $ftp = Expect->spawn( "ftp ms.chinmin.edu.tw")
main::(./down.pl:8):                    or die "Couldn't start program: $!\n";
  DB<14> s
Expect::spawn(/usr/home/lang/lib/perl5/site_perl/5.005/Expect.pm:78):
78:       my($tty);
  DB<14> n
Expect::spawn(/usr/home/lang/lib/perl5/site_perl/5.005/Expect.pm:79):
79:       my($name_of_tty);
  DB<14> n
Expect::spawn(/usr/home/lang/lib/perl5/site_perl/5.005/Expect.pm:80):
80:       my ($class) = shift;
  DB<14> n
Expect::spawn(/usr/home/lang/lib/perl5/site_perl/5.005/Expect.pm:82):
82:       my($self) = new IO::Pty;
  DB<14> n
Expect::spawn(/usr/home/lang/lib/perl5/site_perl/5.005/Expect.pm:83):
83:       bless ($self, $class);
  DB<14> x $self
0  IO::Pty=GLOB(0x840cdc8)
   -> *Symbol::GEN0
         FileHandle({*Symbol::GEN0}) => fileno(4)


The equivalent expression in cygwin evaluates to:

  DB<2> x $self
0  IO::Pty=GLOB(0x4947f5c)
   -> *Symbol::GEN0

Before plunging in and learning more about OOP with perl, I need
to ask am I going to be able to get this working or do I need to
invoke an Expect script with a system call.

The funny thing is I could swear it suddenly started working on a
machine on a different network, after a lot of problems
installing the modules in the right directories. 

The build of the Expect and IO::Pty and IO::Tty modules goes OK.
The perl make of the IO:Pty & TTy Makefile finds ttyname(),
presumably a C library function.

Expect is part of cygwin, so this perl module should work. Or do I
need to learn more about ptys.

-- 
Greg Matheson                    Rather than doing things right,
Chinmin College,                 Doing the right thing. 
Taiwan                           

-- 
Greg Matheson                All teaching is teaching 
Chinmin College,             under difficult circumstances.
Taiwan                           

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019