which hangs at the $connection->open() command, because the session tries to do a 'resize' (i can see this by putting in a $connection->input_log(...) statement). so, for some reason, the TERM variable doesn't seem to be getting set/reset correctly. the equivalent expect script, which looks like this:#!/usr/local/bin/perl use Env qw(TERM); $ENV{TERM} = 'no-resize-vt100'; use Net::Telnet; $connection = new Net::Telnet ( Host=>'ssd.jpl.nasa.gov', Port=>6775); $connection->open(); $connection->waitfor('/Horizons> /'); $connection->print('load vla-1'); $connection->waitfor('/Horizons> /'); $connection->print('page'); $connection->waitfor('/Horizons> /'); $connection->print('799'); $connection->waitfor('/.*Select.*: $/'); $connection->print('e'); $connection->waitfor('/.*Observe.*: $/'); $connection->print('o'); $connection->waitfor('/.*Coordinate.*: $/'); $connection->print('500@399'); $connection->waitfor('/.*Starting.*: $/'); $connection->print('1981-Mar-07 08:00'); $connection->waitfor('/.*Ending.*: $/'); $connection->print('1981-Mar-07 17:00'); $connection->waitfor('/.*interval.*: $/'); $connection->print('10m'); $connection->waitfor('/.*Accept.*: $/'); $connection->print('y'); $connection->waitfor('/.*Select.*: $/'); $connection->print('y'); $connection->print('q'); $connection->close; exit 0;
works perfectly, i.e., the TERM variable seems to get set correctly, and the remote machine never attempts to do the 'resize'.#!/usr/bin/expect set env(TERM) no-resize-vt100 spawn telnet ssd.jpl.nasa.gov 6775 expect "Horizons> " { send "load vla-1\r" } expect "Horizons> " { send page\r } expect "Horizons> " { send 799\r } expect -re ".*Select.*: $" { send e\r } expect -re ".*Observe.*: $" { send o\r } expect -re ".*Coordinate.*: $" { send 500@399\r } expect -re ".*Starting.*: $" { send "1981-Mar-07 08:00\r" } expect -re ".*Ending.*: $" { send "1981-Mar-07 17:00\r" } expect -re ".*interval.*: $" { send 10m\r } expect -re ".*Accept.*: $" { send y\r } expect -re ".*Select.*: $" { send q\r } exit 0
In reply to $ENV{TERM} and Net::Telnet by bbutler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |