diff --git a/lib/SNMP/Info.pm b/lib/SNMP/Info.pm index 0f4deb81..6428d187 100644 --- a/lib/SNMP/Info.pm +++ b/lib/SNMP/Info.pm @@ -4989,8 +4989,7 @@ capabilities to include dynamic methods generated at run time via AUTOLOAD. Calls parent can() first to see if method exists, if not validates that a method should be created then dispatches to the appropriate internal method -for creation. The newly created method is inserted into the symbol table -returning to AUTOLOAD only for the initial method call. +for creation. Returns undef if the method does not exist and can not be created. @@ -5027,15 +5026,21 @@ sub can { # we’ll just create if/when they are called rather than pollute the # symbol table with entries that never get called. + # Between 2012-2020 we actually added the methods generated below to the + # symbol table, but they were global to the SNMP::Info class, while + # methods for different device classes may point to different SNMP + # objects. This made interacting with multiple device types from a single + # script somewhat unreliable. + # Check for set_ ing. if ( $method =~ /^set_/ ) { - return *{$method} = _make_setter( $method, $oid, @_ ); + return _make_setter( $method, $oid, @_ ); } elsif ( defined $funcs->{$base_method} || $table ) { - return *{$method} = _load_attr( $method, $oid, @_ ); + return _load_attr( $method, $oid, @_ ); } else { - return *{$method} = _global( $method, $oid ); + return _global( $method, $oid ); } } @@ -5044,9 +5049,7 @@ sub can { =head2 AUTOLOAD Each entry in either %FUNCS, %GLOBALS, or MIB Leaf node names present in -loaded MIBs are used by AUTOLOAD() to create dynamic methods. Generated -methods are inserted into the symbol table so that subsequent calls can avoid -AUTOLOAD() and dispatch directly. +loaded MIBs are used by AUTOLOAD() to create dynamic methods. =over