From: Sorrell, A. <Al_...@tr...> - 2002-02-26 21:01:28
|
Just downloaded the Expect.pm 1.12 and got IO-Tty-0.95_01 from CPAN. Running under Perl 5.6, Solaris 2.6 I was trying to use the "raw" mode example to keep from having to deal with text I send. Code snippet: #!/usr/local/bin/perl -w # test the Expect.pm module for Perl use Expect; $host='thathost'; $user='me'; $TAC_pass='mypass'; $pass=''; $timeout=10; $port=''; $enable='enable'; # $Expect::Exp_Internal=1; #Debugging # #$login_ok=&login($host,$port,$timeout,$user,$pass,$TAC_PASS,$enable); &login2($host,$port,$timeout,$user,$pass,$TAC_pass,$enable); print "back from login\n"; sub login2 { my($host,$port,$timeout,$user,$pass,$TAC_pass,$enable)=@_; $port=23 if($port eq ''); $exp = Expect->spawn("telnet $host $port") or die "Cannot spawn telnet to $host: $!\n"; $exp->slave_pty->stty('raw'); sleep 1; I get the following error: Spawned 'telnet 6500netrta 23' spawn id(3) Pid: 22387 Tty: /dev/pts/0 Expect::spawn('Expect', 'telnet 6500netrta 23') called at test_perl_expect.pl line 21 main::login2('myhost', '', 10, 'me', '', 'mypass', 'enable') called at test_perl_expect.pl line 16 ERROR: cannot find method `slave_pty' in class Expect at test_perl_expect.pl line 23 What am I doing wrong?? Thanks, Al |