Athanasios Douitsis > SNMP-Class-0.15 > SNMP::Class::Cache

Download:
SNMP-Class-0.15.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.09   Source  

NAME ^

SNMP::Class::Cache - An SNMP::Class::ResultSet which is also a live SNMP::Class session.

SYNOPSIS ^

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);

METHODS ^

add

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') 

has

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.

modules

Returns a list of all the previous arguments that have ever been supplied to the add method of the current object.

syntax highlighting: