develooper Front page | perl.sdk | Postings from May 2004

TELNET

From:
isaac_koenig
Date:
May 24, 2004 15:31
Subject:
TELNET
Message ID:
20040524151244.77084.qmail@onion.perl.org
I am trying to telnet to a server and do some commands. If the commands
fail, I want the program to die and return an error message. However, the
result is the program continues and does not return any error message.
 The following is the code:
print" Start Telnet Session\n";

$telnet=new Net::Telnet ( Timeout=>10,Errmode=>'die',Prompt =>'/\$ $/i');
$telnet->open($host)  or die $telnet->errmsg;
print "Connected to $host\n";

$telnet->login($ftpuser, $ftppass) or die $telnet->errmsg;
print "Logged in as User: $ftpuser \n";

print "\n\nChecking Remote Server Volume Status\n";
print $telnet->cmd($fverify) or die $telnet->errmsg;



print "\n\nChanging the Remote Server Volume Status to Backup\n";
$telnet->cmd($fbbackup) or die myerr();
 print "Changed Volume to Backup\n";




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About