package SNMPMonitor::Plugin; use common::sense; #use NetSNMP::ASN (':all'); sub new { my $obj_class = shift; my $root_oid = shift; my $class = ref $obj_class || $obj_class; my ($name) = $class =~ /::Plugin::(.*)/; my $self = { name => $name, full_name => $class, root_oid => $root_oid, plugin_oid => '', full_oid => '', }; bless $self, $class; # create accessor methods for defined parameters for my $datum (keys %{$self}) { no strict "refs"; *$datum = sub { shift; # XXX: ignore calling class/object $self->{$datum} = shift if @_; return $self->{$datum}; }; } $self->set_oid(); return $self; } # Set the OID using plugin defined OID. sub set_oid { my $self = shift; $self->plugin_oid($self->set_plugin_oid); $self->full_oid($self->root_oid . $self->plugin_oid); } 1; __END__