From 377bb942e0b4088795f43ded29df2a14f2c1979f Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Wed, 29 May 2013 19:46:52 +0100 Subject: [PATCH] avoid undefined warning --- Netdisco/lib/App/Netdisco/Util/SNMP.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Netdisco/lib/App/Netdisco/Util/SNMP.pm b/Netdisco/lib/App/Netdisco/Util/SNMP.pm index fa2ebeb1..e7f1964b 100644 --- a/Netdisco/lib/App/Netdisco/Util/SNMP.pm +++ b/Netdisco/lib/App/Netdisco/Util/SNMP.pm @@ -88,8 +88,8 @@ sub _snmp_connect_generic { my $comm_type = pop; my @communities = @{ setting($comm_type) || []}; unshift @communities, $device->snmp_comm - if length $device->snmp_comm - and length $comm_type and $comm_type eq 'community'; + if defined $device->snmp_comm + and defined $comm_type and $comm_type eq 'community'; my $info = undef; VERSION: foreach my $ver (@versions) { @@ -123,7 +123,7 @@ sub _try_connect { $info = $class->new(%$snmp_args, Version => $ver, Community => $comm); undef $info unless ( (not defined $info->error) - and length $info->uptime + and defined $info->uptime and ($info->layers or $info->description) and $info->class );