/usr/share/doc/libsnmp-session-perl/examples/arp is in libsnmp-session-perl 1.14~git20130523.186a005-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140  | #!/usr/bin/perl -w
## Name:	test/arp
## Author:	Simon Leinen  <simon@switch.ch>
## Description:	Dump ARP table using Perl SNMP library
######################################################################
## Usage: arp hostname [community]
##
## Extracts HOSTNAME's network to media address table using SNMP and
## prints it to standard output.  Example output (errors probably due
## to the agent):
##
## $ perl test/arp babar public
## lo0                  130.59.4.11     dynamic    08:00:20:12:cc:3f
## lo0                  130.59.4.22     dynamic    08:00:20:88:9a:5e
## lo0                  130.59.4.30     dynamic    08:00:20:76:48:af
## lo0                  130.59.4.33     dynamic    08:00:09:f7:f2:9b
## lo0                  130.59.4.38     dynamic    08:00:20:86:95:57
## lo0                  130.59.4.110    dynamic    00:05:02:9c:34:1e
## lo0                  130.59.4.134    dynamic    00:05:02:ec:a3:1b
## lo0                  130.59.4.202    dynamic    00:00:0c:5d:05:d0
## lo0                  224.0.0.0       dynamic    01:00:5e:00:00:00
## lo0                  224.1.127.255   dynamic    01:00:5e:01:7f:ff
## lo0                  224.2.127.253   dynamic    01:00:5e:02:7f:fd
## lo0                  224.2.127.254   dynamic    01:00:5e:02:7f:fe
## lo0                  239.255.255.255 dynamic    01:00:5e:7f:ff:ff
## hme0                 130.59.4.2      dynamic    08:00:20:83:00:69
##
## The interface name in the first column is the ifDescr value for the
## interface to which the ipNetToMediaIfIndex refers.
######################################################################
require 5.002;
use strict;
use SNMP_Session "0.57";	# needs map_table
use BER;
sub out_arp_entry ($$$);
sub ether_hex ($);
sub ifDescr ($$);
sub usage ();
#
#  OIDs we know by name.
#
my %OIDS = (
            'ipNetToMediaPhysAddress' => [1,3,6,1,2,1,4,22,1,2],
            'ipNetToMediaType' => [1,3,6,1,2,1,4,22,1,4],
	    );
my $hostname = $ARGV[0] || usage ();
my $community = $ARGV[1] || "public";
my $session;
die "Couldn't open SNMP session to $hostname"
    unless ($session = SNMP_Session->open ($hostname, $community, 161));
$session->map_table ([$OIDS{'ipNetToMediaPhysAddress'},
		      $OIDS{'ipNetToMediaType'}],
		     \&out_arp_entry);
$session->close ();
1;
## out_arp_entry (INDEX, PHYS_ADDRESS, TYPE)
##
## Writes a line of ARP output from a partial row of the
## ipNetToMediaTable.  The does not use the ipNetToMediaIfIndex or
## ipNetToMediaNetAddress, because those can be derived from the row
## index.
##
sub out_arp_entry ($$$) {
  my ($index, $physAddress, $type) = @_;
  ## the index of this table has the form IFINDEX.IPADDRESS, where
  ## IPADDRESS is a "dotted quad" of four integers.  We simply split
  ## at the first dot to get the interface index and the IP address in
  ## readable notation:
  ##
  my ($ifIndex, $netAddress) = split(/\./, $index, 2);
  $type = pretty_print ($type);
  if ($type eq 1) { $type = "other"; }
  elsif ($type eq 2) { $type = "invalid"; }
  elsif ($type eq 3) { $type = "dynamic"; }
  elsif ($type eq 4) { $type = "static"; }
  $physAddress = ether_hex (hex_string ($physAddress));
  printf STDOUT ("%-20s %-15s %-10s %s\n",
		 ifDescr ($ifIndex, $session),
		 $netAddress,
		 $type,
		 $physAddress);
}
## ether_hex (HEX_STRING)
##
## Converts a raw hex representation into the common form used in
## Ethernet addresses, e.g. "080020830069" becomes
## "08:00:20:83:00:69".
##
sub ether_hex ($) {
  my ($string) = @_;
  $string =~ s/([0-9a-f][0-9a-f])/$1:/g;
  $string =~ s/:$//;
  $string;
}
my %ifDescrCache;
## ifDescr (IFINDEX, SESSION)
##
## Return the interface description associated with the given
## IFINDEX.  Uses SESSION as the destination for SNMP request.
## Results are cached in %ifDescrCache to avoid sending the same SNMP
## request more than once.
##
sub ifDescr ($$) {
    my @ifDescr = split ('\.','1.3.6.1.2.1.2.2.1.2');
    my ($ifIndex, $session) = @_;
    return $ifDescrCache{$ifIndex,$session}
    if defined ($ifDescrCache{$ifIndex,$session});
    push @ifDescr,$ifIndex;
    if ($session->get_request_response (encode_oid (@ifDescr))) {
	my $response = $session->pdu_buffer;
	my ($bindings, $binding, $oid, $value);
	($bindings) = $session->decode_get_response ($response);
	($binding,$bindings) = decode_sequence ($bindings);
	($oid,$value) = decode_by_template ($binding, "%O%@");
	return $ifDescrCache{$ifIndex,$session} = pretty_print ($value);
    } else {
	return "if#".$ifIndex;
    }
}
sub usage () {
  die "usage: $0 host [community]";
}
 |