I had a very urgent query on the telnet module. I tried finding the
information on the net but came up blank on the same.  I am a very recent
freebie and I would really appreciate it if you can help me out here. This
might be a very simple problem, pardon my ignorance but u will really save
me a lot of time if you help me out...

---------------------------------------------
Problem Description

I am trying to telnet to a server who sends me a whole bunch of information
(contained in the motd file )which is followed by the login/password prompt.

I login to the server and after login the server sends me a user specified
prompt W9-TEST-01.


After this prompt is sent by the server I send across a series of commands.
Unfortunately I am not able to capture the above mentioned string and then
issue the commands. I have detailed my program below for your convenience...


I tried using the Prompt option in the Telnet call and also in the Waitfor
call too without any success..

Any help would be very appreciated..
----------------------------------------------------

#!/usr/bin/perl -w
use Net::Telnet ();

$inlogfileg = "./inlog";
$outlogfile = "./outlog";
$dmplog = "./dmplog";
$secs = 30;

print "Before telnet creation \n";
$t = new Net::Telnet (Timeout => 10,
                        Input_log => $inlogfileg,
                        Output_log => $outlogfile,
                        Telnetmode => 1,
                        dump_log => $dmplog,
                        Timeout => $secs);
#                     Prompt => '/[W9-BAS-01\>]/');

$t->open("hostname");
#
$t->login("test","test123");


$t->waitfor('W9-BAS-01\>');
#print $t->cmd('test');

#$t->cmd("exit");
#$t->print("enable");
#print " After the login command is sent \n ";


$t->close;
----------------------------------------------




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to