line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SNMP::Effective::VarList; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
SNMP::Effective::VarList - Helper module for SNMP::Effective::Host |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 DESCRIPTION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Thist module allows oid/oid-methods to be specified in different ways. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use SNMP::Effective::VarList; |
14
|
|
|
|
|
|
|
tie @varlist, 'SNMP::Effective::VarList'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
push @varlist, [$method1, $oid1], [$method2, $oid2]; |
17
|
|
|
|
|
|
|
push @varlist, [$method1, $Varbind_obj1], [$method2, $Varbind_obj2]; |
18
|
|
|
|
|
|
|
push @varlist, [$method1, $VarList_obj1], [$method2, $VarList_obj2]; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
14053
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
48
|
|
23
|
2
|
|
|
2
|
|
5
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
27
|
|
24
|
2
|
|
|
2
|
|
1793
|
use SNMP; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use Tie::Array; |
26
|
|
|
|
|
|
|
use Carp qw/ confess /; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use base qw/ Tie::StdArray /; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub PUSH { |
31
|
|
|
|
|
|
|
my $self = shift; |
32
|
|
|
|
|
|
|
my @args = @_; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
LIST: |
35
|
|
|
|
|
|
|
for my $list (@args) { |
36
|
|
|
|
|
|
|
unless(ref $list eq 'ARRAY') { |
37
|
|
|
|
|
|
|
confess "A list of array-refs are required to push()"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
unless(@$list > 1) { |
40
|
|
|
|
|
|
|
confess "Each array-ref to push() must have more than one element"; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
unless($SNMP::Effective::Dispatch::METHOD{$list->[0]}) { |
43
|
|
|
|
|
|
|
confess "The first element in the array-ref to push() must exist in \%SNMP::Effective::Dispatch::METHOD"; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $method = $list->[0]; |
47
|
|
|
|
|
|
|
my $i = 0; |
48
|
|
|
|
|
|
|
my @varlist; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
OID: |
51
|
|
|
|
|
|
|
for my $oid (@$list) { |
52
|
|
|
|
|
|
|
next unless($i++); # skip the first element, containing the method |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
if(ref $oid eq '') { # create varbind |
55
|
|
|
|
|
|
|
$oid = SNMP::Varbind->new([ $oid ]); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
if(ref $oid eq 'SNMP::Varbind') { # append varbind |
58
|
|
|
|
|
|
|
push @varlist, $oid; |
59
|
|
|
|
|
|
|
next OID; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
if(ref $oid eq 'SNMP::VarList') { # append varlist |
62
|
|
|
|
|
|
|
push @varlist, @$oid; |
63
|
|
|
|
|
|
|
next OID; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
if(@varlist) { |
68
|
|
|
|
|
|
|
push @$self, [ $method, SNMP::VarList->new(@varlist) ]; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
return $self->FETCHSIZE; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 AUTHOR |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
See L |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |