OID(3)
π¦ NAME π¦
NetSNMP::OID β okay so bestie, this is the Perl extension for manipulating OIDs. That's it, that's the whole vibe. π
β¨ SYNOPSIS β¨
Here's the whole mood board, copied exactly so you can just steal it:
use NetSNMP::OID;
my $oid = new NetSNMP::OID('sysContact.0');
if ($oid < new NetSNMP::OID('ifTable')) {
do_something();
}
my @numarray = $oid->to_array();
# appending oids
$oid = new NetSNMP::OID('.1.3');
$oid += ".6.1";
# -> .1.3.6.1
# appending index strings
$oid2 = $oid + "\"wes\"";
# -> .1.3.6.1.3.119.101.115
$oid3 = $oid + "\'wes\'";
# -> .1.3.6.1.119.101.115
$len = $oid3->length();
# -> 7
# retrieving indexes from an oid:
$arrayref = $tableoid->get_indexes()
Like, notice how the quoted string gets its quote characters baked in as numbers and the unquoted one doesn't? That's not a bug, that's just how it do. π«Ά
πΈ DESCRIPTION πΈ
The NetSNMP::OID module is a simple little wrapper around a C-based net-snmp oid β and that oid is literally just an array of unsigned integers. Under the hood the OID is stored as a C array of integers, because speed when you're doing comparisons and stuff. Efficiency queen. π
The standard logical expression operators (<, >, ==, ...) are overloaded so you can do lexographical comparisons with them. So yes, your OID can vibe-check another OID directly. π₯
The + operator is also overloaded, so you can append stuff onto the end of an OID β like index segments of a table, for example. Sticker on the end of the OID, basically. π
π EXPORT π
Here's what actually gets exported:
int snmp_oid_compare(oid1, oid2)
int compare(oid1, oid2)
Two functions, both taking oid1 and oid2. Short and sweet, no notes. β¨
π AUTHOR π
Wes Hardaker, <hardaker@users.sourceforge.net> β icon, legend, the moment. Respect the author fr fr. π
π¦ SEE ALSO π¦
SNMPperl
Go read those too, iykyk. π
π Copyright π
Copyright (c) 2002 Networks Associates Technology, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. So like, go off, but read the terms first bestie. π
and that's the whole page! π« this was perl v5.42.2, dated 2026-04-12, and you've been reading OID(3) β mwah, slay, bye! π
β¨
π¦ where this page comes from
- alpine 3.23: net-snmp-doc 5.9.5.2-r0 Β· Net-SNMP
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms