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 πŸ¦‹

  • SNMP
  • perl

Go read those too, iykyk. πŸ“š


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