line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: General.pm,v 1.2 2003/03/22 17:06:17 cwest Exp $ |
2
|
|
|
|
|
|
|
package POEST::Config::General; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=pod |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
POEST::Config::General - Configuration via Config::General |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 ABSTRACT |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
A poest configurator based on Config::General, a file based |
13
|
|
|
|
|
|
|
configuration. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
The description of the configuration file is explained in |
18
|
|
|
|
|
|
|
L. This configuration class conforms to the |
19
|
|
|
|
|
|
|
specification explained in L. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head2 Example Configuration |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Hostname localhost |
24
|
|
|
|
|
|
|
Port 2525 |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Plugin POEST::Plugin::General |
27
|
|
|
|
|
|
|
Plugin POEST::Plugin::Check::Hostname |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
RequireHost Yes |
30
|
|
|
|
|
|
|
AllowedHost localhost |
31
|
|
|
|
|
|
|
AllowedHost example.com |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
If no configuration file is passed, a list of reasonable default |
34
|
|
|
|
|
|
|
directories are checked for C. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
/usr/local/etc |
38
|
|
|
|
|
|
|
/usr/local/etc/poest |
39
|
|
|
|
|
|
|
/etc/poest |
40
|
|
|
|
|
|
|
./ |
41
|
|
|
|
|
|
|
./etc |
42
|
|
|
|
|
|
|
~/ |
43
|
|
|
|
|
|
|
~/etc |
44
|
|
|
|
|
|
|
~/.poest |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
1
|
|
1310
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
54
|
|
49
|
|
|
|
|
|
|
$^W = 1; |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
1
|
|
5
|
use vars qw[$VERSION]; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
56
|
|
52
|
|
|
|
|
|
|
$VERSION = (qw$Revision: 1.2 $)[1]; |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
1
|
|
2458
|
use Config::General; |
|
1
|
|
|
|
|
178884
|
|
|
1
|
|
|
|
|
94
|
|
55
|
1
|
|
|
1
|
|
15
|
use base qw[POEST::Config]; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
134
|
|
56
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
268
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub new { |
59
|
0
|
|
|
0
|
1
|
|
my ($class, %args) = @_; |
60
|
|
|
|
|
|
|
|
61
|
0
|
0
|
|
|
|
|
ATTEMPT: unless ( $args{ConfigFile} ) { |
62
|
0
|
|
|
|
|
|
my @locations = qw[ |
63
|
|
|
|
|
|
|
/usr/local/etc |
64
|
|
|
|
|
|
|
/usr/local/etc/poest |
65
|
|
|
|
|
|
|
/etc/poest |
66
|
|
|
|
|
|
|
./ |
67
|
|
|
|
|
|
|
./etc |
68
|
|
|
|
|
|
|
~/ |
69
|
|
|
|
|
|
|
~/etc |
70
|
|
|
|
|
|
|
~/.poest |
71
|
|
|
|
|
|
|
]; |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
foreach ( @locations ) { |
74
|
0
|
0
|
0
|
|
|
|
if ( -e "$_/poest.conf" && -f _ && -s _ ) { |
|
|
|
0
|
|
|
|
|
75
|
0
|
|
|
|
|
|
$args{ConfigFile} = "$_/poest.conf"; |
76
|
0
|
|
|
|
|
|
last ATTEMPT; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
0
|
0
|
|
|
|
|
croak 'ConfigFile is empty' unless $args{ConfigFile}; |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
my $self = { ParseConfig( |
84
|
|
|
|
|
|
|
-ConfigFile => $args{ConfigFile}, |
85
|
|
|
|
|
|
|
-LowerCaseNames => 1, |
86
|
|
|
|
|
|
|
) }; |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
return bless $self, $class; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__END__ |