Subject: | Net::SNMP->session not returning correct value when errored |
Date: | Thu, 8 Mar 2018 13:55:51 -0600 |
To: | bug-Net-SNMP [...] rt.cpan.org |
From: | David Walden <ldavidwalden [...] gmail.com> |
When initiating a session and the session cannot be established due to an
incorrect community string and error and undefined session are not being
returned. If an error occurs will not execute the if loop due to no error
being returned.
($session, $error) = Net::SNMP->session(
-hostname => $ip,
-community => $comm,
-version => 'snmpv2c',
-timeout => 2,
-retries => 1,
);
if (!defined($session) {
printf "ERROR: %s.\n", $error;
exit 1;
}