Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I am facing a problem with the NET::TELNET module. I am telnetting to a linux box and there I am trying to run perl script which actually is a expect script. So now the problem is that when the perl expect script is running remotely I am supposed to execute a command and wait for its completion and then execute the next command when I get the prompt. The problem is that I am not able to get the complete command execution and hence the next prompt. I wonder what the problem is, is it like the telnet window is smaller or the output buffer allocated to the telnet session through the perl module is small. Can anyone explain. I have copied some part of the code I hope it helps you.
windows pc telnet code
Linux box expect script code:$telnet_box->open("$host") || die "Failed to connect to $host $!"; $telnet_box->login($user_name, $password) || die "Failed to log onto $host. The username or password is wro +ng$!"; @$lines = $telnet_box->cmd("perl expect_execute.pl");
Output :$exp_inst->log_file("$templog", "w"); $exp_inst->expect($timeout, [ '-re' , $prompt, sub { my $fh = shift; $fh->send("$command\n"); } ], [ timeout => sub { my_die "unable to get the prompt $prompt"; } ] );
Expected:prompt> command More ...
Thanks in advanceprompt> command xyz yy prompt>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: net::telnet problem
by graff (Chancellor) on Jun 25, 2005 at 22:49 UTC |