Skip Menu |

This queue is for tickets about the SNMP-Info CPAN distribution.

Report information
The Basics
Id: 87712
Status: resolved
Priority: 0/
Queue: SNMP-Info

People
Owner: OLIVER [...] cpan.org
Requestors: andy [...] baumhauer.us
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Proposed Patch
Date: Thu, 08 Aug 2013 10:32:29 -0500
To: "SNMP::Info Bug" <bug-SNMP-Info [...] rt.cpan.org>
From: Andrew Baumhauer <andy [...] baumhauer.us>
Gentlemen, I have located a logic error in version 2.08 of Info.pm that affects the caching of returned results. Enclosed is a patch for that issue. --- /2.08/Info.pm 2012-07-15 14:35:37.000000000 -0500 +++ Info.pm 2013-08-08 10:29:12.020871894 -0500 @@ -3825,11 +3825,11 @@ # Load data if it both not cached and we are not requesting partial info. if ( defined $funcs{$attr} ) { return $self->_load_attr( $attr, $funcs{$attr}, @_ ) - unless ( defined $self->{"_${attr}"} and !scalar(@_) ); + if ( !exists $self->{"_${attr}"} || $_[0]); } if ($table_leaf) { - return $self->_load_attr( $attr, $attr, @_ ) - unless ( defined $self->{"_${attr}"} and !scalar(@_) ); + return $self->_load_attr( $attr, $attr, @_ ) + if ( !exists $self->{"_${attr}"} || $_[0]); } return $self->_show_attr($attr);
Hi Andy, Thanks for this report. Unfortunately since SNMP::Info 3.00 this code has been refactored so from the details below I cannot tell whether we still have any issue. Please would you be able to test again with the current SNMP::Info from CPAN, and/or provide a failing test case or description of how to reproduce the cache error? If upgrading, you might also wish to review the documentation, e.g. the clear_cache(), update() methods, etc. regards, oliver. On Thu Aug 08 11:32:52 2013, andy@baumhauer.us wrote: Show quoted text
> Gentlemen, > > I have located a logic error in version 2.08 of Info.pm that affects the > caching of returned results. Enclosed is a patch for that issue. > > --- /2.08/Info.pm 2012-07-15 14:35:37.000000000 -0500 > +++ Info.pm 2013-08-08 10:29:12.020871894 -0500 > @@ -3825,11 +3825,11 @@ > # Load data if it both not cached and we are not requesting > partial info. > if ( defined $funcs{$attr} ) { > return $self->_load_attr( $attr, $funcs{$attr}, @_ ) > - unless ( defined $self->{"_${attr}"} and !scalar(@_) ); > + if ( !exists $self->{"_${attr}"} || $_[0]); > } > if ($table_leaf) { > - return $self->_load_attr( $attr, $attr, @_ ) > - unless ( defined $self->{"_${attr}"} and !scalar(@_) ); > + return $self->_load_attr( $attr, $attr, @_ ) > + if ( !exists $self->{"_${attr}"} || $_[0]); > } > > return $self->_show_attr($attr); >
-- regards, oliver.