C
Chris G.
I have a script that reads in a csv files, parses the data, and uses the
info to run down a list of IP addresses and make telnet connections to
them. I do this to automate the backing up of my Foundry switch
configurations. This works great until I have an error. When I have an
error at connect time, it catches the error and reports it, just like I
want. However, it doesn't recover from the error and never makes any
more connections to the other switches, even though it says it does.
Here is my (relevant) code:
use warnings;
use strict;
use Net::Telnet;
sub GetCF;
sub GetCF {
my $telnet;
$telnet = new Net::Telnet ( Timeout=>10,
Host=>$ip,
Errmode=>\&uhoh,
);
<skipping commands executed after the connection is established>
}
sub uhoh {
if ( $@ ne "") {
print ("$@\n");
} else {
print "Success\n";
}
}
info to run down a list of IP addresses and make telnet connections to
them. I do this to automate the backing up of my Foundry switch
configurations. This works great until I have an error. When I have an
error at connect time, it catches the error and reports it, just like I
want. However, it doesn't recover from the error and never makes any
more connections to the other switches, even though it says it does.
Here is my (relevant) code:
use warnings;
use strict;
use Net::Telnet;
sub GetCF;
sub GetCF {
my $telnet;
$telnet = new Net::Telnet ( Timeout=>10,
Host=>$ip,
Errmode=>\&uhoh,
);
<skipping commands executed after the connection is established>
}
sub uhoh {
if ( $@ ne "") {
print ("$@\n");
} else {
print "Success\n";
}
}