Subject: | add_oid_tree bug? |
Date: | Wed, 20 May 2009 21:18:11 +0100 |
To: | bug-SNMP-Extension-PassPersist [...] rt.cpan.org |
From: | Simon Brown <slb-cpan [...] silent.co.uk> |
Hi
First, thank you for a very helpful module :-)
I think there maybe a small bug in the type validation code
for add_oid_tree. The following test program demonstrates what
I think is wrong:
#!/usr/bin/perl
use SNMP::Extension::PassPersist;
my $e = SNMP::Extension::PassPersist->new;
$e->add_oid_tree({ 0 => [ 'counter', 1 ]});
exit 0;
... running it gives:
$ ~slb/bug.pl
error: Unknown type at /home/slb/bug.pl line 6
The following tiny patch fixes it for me:
@@ -229,7 +229,7 @@
my ($self, $new_tree) = @_;
croak "error: Unknown type"
- if any { !$snmp_ext_type{$_[0]} } values %$new_tree;
+ if any { !$snmp_ext_type{$_->[0]} } values %$new_tree;
my $oid_tree = $self->oid_tree;
@{$oid_tree}{keys %$new_tree} = values %$new_tree;
Best Regards
Simon