perl Expect module can't open pty on cygwin

Greg Matheson lang@ms.chinmin.edu.tw
Wed Apr 18 21:53:00 GMT 2001


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



More information about the Cygwin mailing list