I'm using the Net::SNMP module to requests for gets and walks to a server, I thought it would be a good idea to use the lex_oid_sort function to get my array of OIDs in to a logical order before sending the requests. The strange thing is, the function always returns an array where the first element is "Net::SNMP" with the rest of it being the sorted OIDs.
Here's a test I threw together:
use strict;
use Net::SNMP;
my @unsort = qw/ 1.3.6.1.2.1.1.5 1.3.6.1.2.1.1.4 1.3.6.1.2.1.1.1 1.3.6
+.1.2.1.1.2/;
my @sort = Net::SNMP->oid_lex_sort(@unsort);
local $, = "\n";
print @unsort;
print "\n-------\n";
print @sort;
Output:
1.3.6.1.2.1.1.5
1.3.6.1.2.1.1.4
1.3.6.1.2.1.1.1
1.3.6.1.2.1.1.2
-------
Net::SNMP
1.3.6.1.2.1.1.1
1.3.6.1.2.1.1.2
1.3.6.1.2.1.1.4
1.3.6.1.2.1.1.5
Any clue why it's doing this? I'm fairly new to this whole perl module thing, but the documentation doesn't say anything about this kind of behavior.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.