bug with using last inside try{}

This commit is contained in:
Oliver Gorwits
2012-12-20 20:52:47 +00:00
parent b41115f173
commit e847de5baf

View File

@@ -128,15 +128,17 @@ sub snmp_connect {
);
my $info = undef;
my $last_comm = 0;
COMMUNITY: foreach my $c (@{ setting('community_rw') || []}) {
try {
$info = SNMP::Info->new(%snmp_args, Community => $c);
last COMMUNITY if (
++$last_comm if (
$info
and (not defined $info->error)
and length $info->uptime
);
};
last COMMUNITY if $last_comm;
}
return $info;