sub
PUSH {
my
$self
=
shift
;
my
@args
=
@_
;
LIST:
for
my
$list
(
@args
) {
unless
(
ref
$list
eq
'ARRAY'
) {
confess
"A list of array-refs are required to push()"
;
}
unless
(
@$list
> 1) {
confess
"Each array-ref to push() must have more than one element"
;
}
unless
(
$SNMP::Effective::Dispatch::METHOD
{
$list
->[0]}) {
confess
"The first element in the array-ref to push() must exist in \%SNMP::Effective::Dispatch::METHOD"
;
}
my
$method
=
$list
->[0];
my
$i
= 0;
my
@varlist
;
OID:
for
my
$oid
(
@$list
) {
next
unless
(
$i
++);
if
(
ref
$oid
eq
''
) {
$oid
= SNMP::Varbind->new([
$oid
]);
}
if
(
ref
$oid
eq
'SNMP::Varbind'
) {
push
@varlist
,
$oid
;
next
OID;
}
if
(
ref
$oid
eq
'SNMP::VarList'
) {
push
@varlist
,
@$oid
;
next
OID;
}
}
if
(
@varlist
) {
push
@$self
, [
$method
, SNMP::VarList->new(
@varlist
) ];
}
}
return
$self
->FETCHSIZE;
}
1;