Skip Menu |

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

Report information
The Basics
Id: 70584
Status: stalled
Worked: 6 min
Priority: 0/
Queue: Net-SNMP

People
Owner: dtown [...] cpan.org
Requestors: BitCard [...] ResonatorSoft.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: v6.0.1
Fixed in: (no value)



Subject: Small change to make Net::SNMP::PDU::var_bind_list more compatible with Net::SNMP::XS
From the source for Net::SNMP::XS: http://cpansearch.perl.org/src/MLEHMANN/Net-SNMP-XS-1.2/XS.pm package Net::SNMP::PDU; # var_bind_list hardcodes oid_lex_sort. *sigh* # we copy it 1:1, except for using oid_lex_sort. sub var_bind_list { my ($this, $vbl, $types) = @_; ...etc... @{$this->{_var_bind_names}} = Net::SNMP::oid_lex_sort keys %$vbl; ...etc... } So, fixing this would require one change: Old: @{$this->{_var_bind_names}} = map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { my $oid = $_; $oid =~ s/^\.//; $oid =~ s/ /\.0/g; [$_, pack 'N*', split m/\./, $oid] } keys %{$vbl}; New: @{$this->{_var_bind_names}} = Net::SNMP::oid_lex_sort keys %$vbl; The line in question looks to be completely compatible with the non-XS version. The replacement oid_lex_sort is functionality identical to the hardcoded routine. Unless I'm mistaken, this is probably just an oversight when you were replacing other hardcodes with oid_lex_sort. This change wouldn't actually do anything functionality, but it would mean that the XS author wouldn't need to put in the entire subroutine and keep things sync'd up when it changes.
Including this patch would create a circular dependency between the Net::SNMP module and the Net::SNMP::PDU modules. The Net::SNMP::PDU module would not be usable as a stand alone module. The problem will be resolved by moving the code to the sub-module and using that code in Net::SNMP.
On Tue Nov 01 22:38:07 2011, DTOWN wrote: Show quoted text
> Including this patch would create a circular dependency between the > Net::SNMP module and the Net::SNMP::PDU modules. The Net::SNMP::PDU > module would not be usable as a stand alone module. The problem will be > resolved by moving the code to the sub-module and using that code in > Net::SNMP.
Submodule? Which one? Some options: 1. Net::SNMP::Message (which Net::SNMP would need to use, but is already in PDU) 2. PDU directly (which Net::SNMP already uses, and of course it would work in PDU) 3. A new Net::SNMP::OIDUtil (would include other stuff like oid_base_match oid_lex_cmp oid_lex_sort ticks_to_time)
The change would be placed into the Net::SNMP::Message module. This change will be addressed when there are enough changes to the Net::SNMP module to warrant a new release.