From: Roland G. <RGi...@cp...> - 2004-05-26 13:41:22
|
Thanks for the fix. I hope I will find the time to check what exactly is needed from the POSIX module (can't remember offhand). Unfortunately my current working and personal situation does not leave time for much maintainance, but rest assured that Expect and IO::Pty are NOT orphaned. :o) I will try to create a new release in the next few days (there are several fixes waiting to be released). Roland John Wingenbach wrote: > After much fun, I have found the solution to a bug in Expect.pm. The > problem surfaces in the attempt to retrieve a slave (e.g. > clone_winsize_from): > > > from IO::Pty: > > sub slave { > @_ == 1 or croak 'usage: $pty->slave();'; > > my $master = shift; > > if (exists ${*$master}{'io_pty_slave'}) { > return ${*$master}{'io_pty_slave'}; > } > > my $tty = $master->ttyname(); > > my $slave = new IO::Tty; > > $slave->open($tty, O_RDWR | O_NOCTTY) || > croak "Cannot open slave $tty: $!"; > > return $slave; > } > > > Note that the creation of the slave (assuming the if test fails), is > dependent upon retrieving the ttyname. However, Expect.pm "use"s both > POSIX and IO::Pty. The problem with the default 'use POSIX;' is that > POSIX also has a ttyname declaration and thus once an Expect object is > blessed, the ttyname function used is NOT the IO::Pty one. The solution > is to limit what is being incorporated into Expect from the POSIX > module. From my limited tests, I have been able successfully change the > use line to: > > use POSIX qw (WNOHANG); > > With this change, the ttyname function can be called and the name > retrieved. Thus, window resizing: > > $e = new Expect; > $e->slave->clone_winsize_from(\*STDIN); > $SIG{WINCH} = \&winch; > > > sub winch { > $e->slave->clone_winsize_from(\*STDIN); > kill WINCH => $e->pid if $e->pid; > $SIG{WINCH} = \&winch; > } > > > works as well as any other call which needs to retrieve the ttyname from > the expect object. > > Cheers, > > John C. Wingenbach > > > PS... I am assuming that the authors/maintainers of Expect are no longer > active as I have not seen any kind of involvement from them on the lists > nor on CPAN. > > > Is Expect.pm a dead or orphaned module? > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: Oracle 10g > Get certified on the hottest thing ever to hit the market... Oracle 10g. > Take an Oracle 10g class now, and we'll give you the exam FREE. > http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > |