SNMP::Class::Cache - An SNMP::Class::ResultSet which is also a live SNMP::Class session.
The SNMP::Class::Cache class can be used as a combination of an SNMP::Class session object and an SNMP::Class::ResultSet object. This roughly means that the same object can be used both for querying and storing the results of SNMP queries.
#create a session as usual my $s = SNMP::Class::Cache({DestHost => $myhost1}); #add the ifTable to the Cache $s->add("ifTable"); #use it like an ordinary ResultSet print $s->ifTable->find(ifDescr=>'eth0')->ifSpeed; #Check whether the ifTable tree has been walked already print "ifTable already there" if ( $s->has("ifTable") ); #or, get a list of the stuff already added to our resultset print join(',',$s->modules);
Walks the supplied object id's and adds the results to the resultset. The object id's can be many, e.g.
$s->add('system','interfaces')
Returns true if the name supplied as argument has been walked in a previous add operation. Note that there is exact string comparison between the argument of the previous add call and the argument of the current has call. So, ifTable and .1.3.6.1.2.1.2.2 won't match. This behavior may change in the future.
Returns a list of all the previous arguments that have ever been supplied to the add method of the current object.
To install SNMP::Class, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SNMP::Class
CPAN shell
perl -MCPAN -e shell install SNMP::Class
For more information on module installation, please visit the detailed CPAN module installation guide.