bug with using last inside try{}
This commit is contained in:
@@ -128,15 +128,17 @@ sub snmp_connect {
|
|||||||
);
|
);
|
||||||
|
|
||||||
my $info = undef;
|
my $info = undef;
|
||||||
|
my $last_comm = 0;
|
||||||
COMMUNITY: foreach my $c (@{ setting('community_rw') || []}) {
|
COMMUNITY: foreach my $c (@{ setting('community_rw') || []}) {
|
||||||
try {
|
try {
|
||||||
$info = SNMP::Info->new(%snmp_args, Community => $c);
|
$info = SNMP::Info->new(%snmp_args, Community => $c);
|
||||||
last COMMUNITY if (
|
++$last_comm if (
|
||||||
$info
|
$info
|
||||||
and (not defined $info->error)
|
and (not defined $info->error)
|
||||||
and length $info->uptime
|
and length $info->uptime
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
last COMMUNITY if $last_comm;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $info;
|
return $info;
|
||||||
|
|||||||
Reference in New Issue
Block a user