I actually figured out the sub. All that it does is check list of active IP's pulled in from SNMP against the hash and adds the new ones. I still need to add the part to strip out the old ones.
anyway, the working code is:
sub loadIPs {
my $datahashref = shift;
my $parmhashref = shift;
my $IPs = '1.3.6.1.2.1.10.127.1.3.3.1.3';
my ($session, $error) = Net::SNMP->session(%$parmhashref);
my $reply = $session->get_table(-baseoid=> $IPs);
my %reply = %$reply;
while ( my ($oid, $ip) = each(%reply) ) {
my %tmpHash = ('rx'=>undef, 'tx'=>undef);
$$datahashref{$ip} = %tmpHash unless exists $$datahashref{$ip};
}
}
it was the $$ reference I wasn't grasping.
When I mentioned stale data, I didn't mean it as a bad thing; just a word to differentiate it from the new stuff, and I want the script to just update the hash on the fly. No clearing out the whole thing and starting fresh.
I was actually hoping to keep the GUI refresh rate higher then the time it takes to query all the modems. On a large plant, the query process can take a full minute or two, and I'd like to be able to watch the changes trickle in.
I'll have to read up on the threads::shared mod
thanks