Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

getting output of telnet from perl

59 views
Skip to first unread message

kishore...@gmail.com

unread,
Apr 6, 2006, 7:29:14 AM4/6/06
to
hi
i had written code to connect to unix server from Windows xp(telnet)
where i installed perl.
i have to do with telnet. I think I am able to connect with unix
server. but i am not able to get out put from the server. i have
triedwith 'ls' and 'who' commands. But i am not able to getting any
output from server.
The code is :

use Net::Telnet;


# instantiate a new CGI object
my $telnet = new Net::Telnet(Timeout => 10,
Errmode => 'die');


$telnet->open("servername") or die "hai $telnet->errmsg ";
print "connected";
$telnet->waitfor('/login: $/i');
$telnet->print("ixlourd") or die $telnet->errmsg;
$telnet->waitfor('/password: $/i');
$telnet->print("qwest1") or die $telnet->errmsg;
print "logged in";
$telnet->waitfor('/ixlourd\@e2epia2: $/');
print "Before ls";
$telnet->print('who');
$telnet->waitfor('/ixlourd\@e2epia2: $/');
#$output = $telnet->waitfor('/\$ $/i');
print $output;
@lines=$telnet->print("ls") or die $telnet->errmsg;


print @lines;


OUTPUT:
"connectedlogged inBefore ls".


I have copied telnet.pm module from CPAN to perl directory. why it is
not giving any output of 'ls' . it is simply it is giving
"connectedlogged inBefore ls"
How can i make check whether it is connected to my unix server
successfully.
Thanks,
kishore

0 new messages