line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Xymon::Server; |
2
|
1
|
|
|
1
|
|
50291
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
52
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
BEGIN { |
5
|
1
|
|
|
1
|
|
6
|
use Exporter (); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
23
|
|
6
|
1
|
|
|
1
|
|
7
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
216
|
|
7
|
1
|
|
|
1
|
|
3
|
$VERSION = '0.02'; |
8
|
1
|
|
|
|
|
18
|
@ISA = qw(Exporter); |
9
|
|
|
|
|
|
|
#Give a hoot don't pollute, do not export more than needed by default |
10
|
1
|
|
|
|
|
3
|
@EXPORT = qw(); |
11
|
1
|
|
|
|
|
2
|
@EXPORT_OK = qw(); |
12
|
1
|
|
|
|
|
417
|
%EXPORT_TAGS = (); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#################### subroutine header end #################### |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub new |
20
|
|
|
|
|
|
|
{ |
21
|
1
|
|
|
1
|
0
|
13
|
my ($class, $parameters) = @_; |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
33
|
|
|
16
|
my $self = bless ({}, ref ($class) || $class); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
10
|
$self->{'HOME'} = $parameters->{HOME}; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
2
|
my $fh; |
29
|
1
|
|
|
|
|
46
|
open($fh, "<",$self->{HOME}."/etc/hobbitserver.cfg"); |
30
|
1
|
|
|
|
|
7
|
while(<$fh>) { |
31
|
0
|
|
|
|
|
0
|
chomp; |
32
|
0
|
0
|
0
|
|
|
0
|
if(!m/^#/ && m/\w+/) { |
33
|
0
|
|
|
|
|
0
|
s/\"//g; |
34
|
0
|
|
|
|
|
0
|
s/\#.*$//g; |
35
|
0
|
|
|
|
|
0
|
my @fields = (split(/=|\s+/)); |
36
|
0
|
|
|
|
|
0
|
my $field = shift @fields; |
37
|
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
0
|
if( @fields > 1 ) { |
39
|
0
|
|
|
|
|
0
|
$self->{$field} = \@fields; |
40
|
|
|
|
|
|
|
} else { |
41
|
0
|
|
|
|
|
0
|
$self->{$field} = $fields[0]; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
5
|
return $self; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
#################### main pod documentation begin ################### |
53
|
|
|
|
|
|
|
## Below is the stub of documentation for your module. |
54
|
|
|
|
|
|
|
## You better edit it! |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 NAME |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Xymon::Server - Xymon Server Interface |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 SYNOPSIS |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
use Xymon::Server; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
my $server = Xymon::Server->({ HOME => '/home/hobbit/server' }); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
print $server->{BBPORT}; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 DESCRIPTION |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Provides a base interface for retriving configuration variables from |
75
|
|
|
|
|
|
|
the hobbit server (taken from hobbitserver.cfg). |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 METHODS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Xymon::Server->hobbitserver(); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Returns a hash of configuration items from hobbitserver.cfg; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 BUGS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 SUPPORT |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 AUTHOR |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
David Peters |
96
|
|
|
|
|
|
|
CPAN ID: DAVIDP |
97
|
|
|
|
|
|
|
http://www.electronf.com |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 COPYRIGHT |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
This program is free software; you can redistribute |
102
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
The full text of the license can be found in the |
105
|
|
|
|
|
|
|
LICENSE file included with this module. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 SEE ALSO |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
perl(1). |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
#################### main pod documentation end ################### |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
1; |
118
|
|
|
|
|
|
|
# The preceding line will help the module return a true value |
119
|
|
|
|
|
|
|
|