Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/perl -w
use strict;
use Net::SNMP;
use Getopt::Long;
use Data::Dumper;
use lib "/usr/lib/nagios/plugins";
use utils qw (%ERRORS &print_revision);
my $PROGNAME = "check_snmp_traffic";
<integer> => PMC 'mekso;Grammar' => "ni'upa" @ 0 {
<prefixsign> => ResizablePMCArray (size:1) [
PMC 'mekso;Grammar' => "ni'u" @ 0
]
<PA> => ResizablePMCArray (size:1) [
PMC 'mekso;Grammar' => "pa" @ 4
]
}
rule sumti {
'li' <mekso> {*} #= li
}
.sub 'new' :method
.param pmc args :slurpy
.local pmc iter
$P0 = new 'bridi'
iter = new 'Iterator', args
iter_loop:
unless iter goto iter_end
$P1 = shift iter
$P0.'add_terbri'($P1)
goto iter_loop
[15:11] [inara:/Users/treed/code/mekso]% ./mekso --target=past
> cusku li pa
"past" => PMC 'PAST;Block' {
<blocktype> => "declaration"
<source> => "cusku li pa\n"
<pos> => 0
<hll> => "mekso"
}
.sub 'get_terbri' :method :multi(_)
$P0 = getattribute self, 'terbri'
.return ($P0)
.end
.sub 'get_terbri' :method :multi(_,I)
.param int arg
$P0 = getattribute self, 'terbri'
$P1 = $P0[arg]
vomei cipra
.i pamai dunxu'a li re su'i re li vo
.i remai dunxu'a li vo vu'u re li re
.i cimai dunxu'a li re pi'i ci li xa
.i vomai dunxu'a li bi fe'i re li vo
.sub 'new' :method
.param int mei :named('mei') :optional
.param pmc args :slurpy
.local pmc iter, bridi
.local string selbri
selbri = typeof self
bridi = new selbri
bridi.'set_selbri'(selbri)
$P0 = new 'ResizablePMCArray'
bridi.'set_terbri'($P0)
> pamai dunxu'a li pa li pa
ok 1
> vomai dunxu'a li pa su'i pa li re
ok 4
> vomai dunxu'a li pa li re
not ok 4
.sub main :main
$P0 = new 'BigNum'
$P0 = 100
say $P0
.end