Hi ALL

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

$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");
Linux box expect script code:
$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"; } ] );
Output :
prompt> command More ...
Expected:
prompt> command xyz yy prompt>
Thanks in advance

In reply to net::telnet problem by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.