in reply to Net::SNMP get_request() caching results?

I've seen this before. Perhaps someone knowing the guts of Net::SNMP better than myself could throw more light into this.

Something that has worked quite reliably for me is to destroy and re-create the SNMP object after each error. This is probably not too costly, since creating a UDP socket does not require a connection setup.

The code I use, looks like the following:

sub my_create_snmp { my $snmp = ... # Place here the code to create your # SNMP handler. return $snmp; } ... $response = $session->get_request($cmd); if (!defined($response)) { ... $session = my_create_snmp(); next; }
Note however that you must ensure that the required parameters to create a new SNMP session are available to my_create_snmp(). This probably includes global variables or constants. I tend to prefer the later.

Regards.