|The stupid question is the question not asked|
not able to reach to the prompt while using Net::Telnetby godsown (Novice)
|on Dec 09, 2009 at 11:44 UTC||Need Help??|
godsown has asked for the
wisdom of the Perl Monks concerning the following question:
I am new to Perl and currently trying to create a Telnet session using Net::Telnet.
Usually after providing the username and passwd, the system prints a banner and at the end of it is a question ("Are you sure to continue? (Y/N)? : "). Only on answering a yes to that question, I can login to the system. Also after giving the yes, followed by 'pressing of enter key on keyboard', i again have to press the enter key one more time to finally get to the shell prompt.
Now, while using the Net::telnet, i am able to provide the login and passwd.. but I am not sure how to provide the 'Y' to the question followed by pressing of enter key, followed by another press of enter key.. I currently m using the following:
my $t = new Net::Telnet (Timeout => 10);
$t->waitfor('/"Are you sure to continue\? (Y\/N)\? : "/');
$t->waitfor('/Please hit <return> to continue /');
But I am getting this error: " pattern match timed-out at jtry.pl " this is occuring at the third waitfor() call.
Please let me know what wrong am I doing here ? Any other suggestion ?