fixed clear_cache()

This commit is contained in:
Max Baker
2003-04-29 18:00:11 +00:00
parent d5f1a1ae95
commit f9a97d7a3b

13
Info.pm
View File

@@ -519,12 +519,18 @@ Clears the cached data. This includes GLOBALS data and TABLE METHOD data.
=cut =cut
sub clear_cache { sub clear_cache {
my $self = shift; my $self = shift;
print "SNMP::Info::clear_cache() - Cache Cleared.\n" if $self->debug();
# Clear cached global values and table method flag for being cached
foreach my $key (keys %$self){ foreach my $key (keys %$self){
next unless defined $key; next unless defined $key;
next unless $key =~ /^_/; next unless $key =~ /^_/;
delete $self->{$key}; delete $self->{$key};
} }
# Clear store for tables
$self->store({});
} }
=item $info->debug(1) =item $info->debug(1)
@@ -1572,15 +1578,18 @@ sub session {
return $self->{sess}; return $self->{sess};
} }
=item $info->store() =item $info->store(new_store)
Returns hash store for Table functions. Returns or sets hash store for Table functions.
Store is a hash reference in this format :
$info->store = { attribute => { iid => value , iid2 => value2, ... } }; $info->store = { attribute => { iid => value , iid2 => value2, ... } };
=cut =cut
sub store { sub store {
my $self = shift; my $self = shift;
$self->{store} = $_[0] if @_;
return $self->{store}; return $self->{store};
} }