Namespace question for new SNMP modules

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I'm currently working on releasing a new distribution which I'm calling
Class::SNMP.  As this is my first release to CPAN, I'm a bit apprehensive
about some of the coding decisions I've made, and hope that I'll get some
feedback after people look at what I've written.  Firstly, though, I was
hoping to get some namespace advice.

With Class::SNMP, you can easily create your own class of an SNMP device
which you need to get and set values on, and trap traps from.  From my POD:

  package My::SNMPDevice;
  use base 'Class::SNMP';

      mib => 'My-Custom-Device-MIB',
      mib_root => 'mycustomdevice',

  package main;

  use My::SNMPDevice;

  my $device = My::SNMPDevice->new(
      hostname => ''
  print "Has a " . $device->Uptime . " uptime\n";
  print "Port 4 is at speed " . $device->Ports->Entry(4)->Speed . " Mbps\n";

That's all fine and straight forward, and I feel confident that
Class::SNMP is the appropriate place for this.  However, when I get into
traps, it gets more vague.

For trap handling, I would like a way to represent a trap as something a
bit more structured than a hashref.  I've created a module SNMP::Trap
which is a simple trap object with accessors (thanks to Class::Accessor)
with object creation from a raw UDP trap packet (thanks to
Mon::SNMP) or the output of snmptrapd.  Is it appropriate for this to be
SNMP::Trap?  Or should it be Net::SNMP::Trap?  Or something else?  And
should I release it into a different distribution since it's out of the
Class::SNMP namespace?

This trap object I then will pass to a wrapper into a user-specific class
for dispatching.  See this example code:

  use SNMP::Trap;
  use My::SNMPDevice;  # A subclass of Class::SNMP

  my $trap = SNMP::Trap->parse_snmptrapd_from_stdin();
  my $obj_trap = My::SNMPDevice->parse_trap($trap); # expects SNMP::Trap
  # $obj_trap isa Class::SNMP::Trap + My::SNMPDevice::Trap::<name>

  my $success = $obj_trap->dispatch({
      alarmWarning   => sub { 1 };
      _namer         => 'trap_%s',
      _default       => \&trap_unhandled,
  if (! $success) {
      print "Couldn't dispatch for trap:\n" . $obj_trap->describe;

  sub trap_alarmCritical {
      my ($trap) = @_;
      print $trap->hostname . " is critical: " . $trap->alarmInformation . "\n";

So, is SNMP::Trap appropriate?

Additionally, in classic feature-creep programming style, I now am wanting
to implement a Perl-based SNMP trap daemon since auto method generation
code is slow and therefore using trap dispatch from snmptrapd.conf
would be too slow. So, I'm thinking Net::Server::SNMP, but it wouldn't be
a full SNMP server, just the a trapd, so would Net::Server::SNMP::Trap be
more appropriate? Or Net::SNMP::Server::Trap?  This would use the
SNMP::Trap objects (above) as the basis for trap handling and dispatch,
and would also seemingly need to be in a different distribution.

One last question (I know, I have a lot).  I've identified a bug or two in
SNMP::Mib::Compiler (which I use heavily) and a needed extra feature to
Convert::BER.  These modules haven't been updated lately, and I was
worried that I'll try and get patches to the maintainers and they won't
be reachable.  If a module is 5+ years old and the maintainer is not
reachable (this is just hypothetical at this point), what's the protocol
to handle updating the code?

Thanks in advance!  Sorry for the long post.

Eric Waters

Site Timeline