in reply to Getting Convert::ASN1 to parse SNMP traps

Update: I gave up on Convert::ASN1, and switched down to Convert::BER. The structure of SNMP traps is relatively straightforward, and I was able to cobble a BER parser together quite quickly - borrowing a bit from Mon:SNMP to get started.

If anyone someday supersearches for this, and attempts the same, I suggest reading this bug report before beginning, as it outlines some essentially required modifications. In particular, if you actually want to get the values sent (update: by values, I mean the VarBindList values), you need to attempt to decode them...

my $ret; for my $type ( qw{ STRING BOOLEAN INTEGER REAL } ) { return $ret if defined( $ber->decode( $type => \$ret )); } return $ber->buffer();

...though, of course, the encoding type is normally based on the identifying OID, so if you have a list of all the OIDs you might receive and their types, you can be more efficient about it. It also seems to me that BER is rich enough that you should be able to probe for the type of the next token, but I haven't found an obvious method for this yet.