Track down mysterious CARP_TRACE, don’t try to AUTOLOAD or create method through can()
Remove test for previous appearance in _global
This commit is contained in:
@@ -3884,7 +3884,6 @@ These methods return data as a scalar.
|
|||||||
sub _global {
|
sub _global {
|
||||||
my $method = shift;
|
my $method = shift;
|
||||||
my $oid = shift;
|
my $oid = shift;
|
||||||
return if $method eq 'CARP_TRACE';
|
|
||||||
|
|
||||||
return sub {
|
return sub {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
@@ -4680,6 +4679,8 @@ sub can {
|
|||||||
# use results of parent can()
|
# use results of parent can()
|
||||||
return $self->SUPER::can($method) if $self->SUPER::can($method);
|
return $self->SUPER::can($method) if $self->SUPER::can($method);
|
||||||
|
|
||||||
|
return if $method eq 'CARP_TRACE';
|
||||||
|
|
||||||
my $validated = $self->_validate_autoload_method($method);
|
my $validated = $self->_validate_autoload_method($method);
|
||||||
return unless $validated;
|
return unless $validated;
|
||||||
|
|
||||||
@@ -4756,6 +4757,8 @@ sub AUTOLOAD {
|
|||||||
my $self = shift;
|
my $self = shift;
|
||||||
my ($sub_name) = $AUTOLOAD =~ /::(\w+)$/;
|
my ($sub_name) = $AUTOLOAD =~ /::(\w+)$/;
|
||||||
|
|
||||||
|
return if $sub_name eq 'CARP_TRACE';
|
||||||
|
|
||||||
# Typos in function calls in SNMP::Info subclasses turn into
|
# Typos in function calls in SNMP::Info subclasses turn into
|
||||||
# AUTOLOAD requests for non-methods. While this is deprecated,
|
# AUTOLOAD requests for non-methods. While this is deprecated,
|
||||||
# we'll still get called, so report a less confusing error.
|
# we'll still get called, so report a less confusing error.
|
||||||
|
|||||||
@@ -921,7 +921,7 @@ sub store : Tests(4) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub private_global : Tests(15) {
|
sub private_global : Tests(14) {
|
||||||
my $test = shift;
|
my $test = shift;
|
||||||
|
|
||||||
can_ok($test->{info}, '_global');
|
can_ok($test->{info}, '_global');
|
||||||
@@ -998,11 +998,6 @@ sub private_global : Tests(15) {
|
|||||||
cmp_deeply($test->{info}->cache(),
|
cmp_deeply($test->{info}->cache(),
|
||||||
$expected_cache, 'Cache contains expected data');
|
$expected_cache, 'Cache contains expected data');
|
||||||
|
|
||||||
# Not sure if we need this anonymous sub, added by this commit
|
|
||||||
# https://github.com/netdisco/snmp-info/commit/07605051f5886ffd05f65cfbc1804c316ed904ba
|
|
||||||
is(SNMP::Info::_global('CARP_TRACE'),
|
|
||||||
undef, 'CARP_TRACE passed to _global() returns undef');
|
|
||||||
|
|
||||||
# Simulate session error, i.e. get fails
|
# Simulate session error, i.e. get fails
|
||||||
$test->{info}{sess}{ErrorStr} = 'Get Failed';
|
$test->{info}{sess}{ErrorStr} = 'Get Failed';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user