| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Apache2::ASP::ConfigParser; |
|
3
|
|
|
|
|
|
|
|
|
4
|
24
|
|
|
24
|
|
89
|
use strict; |
|
|
24
|
|
|
|
|
30
|
|
|
|
24
|
|
|
|
|
658
|
|
|
5
|
24
|
|
|
24
|
|
87
|
use warnings 'all'; |
|
|
24
|
|
|
|
|
23
|
|
|
|
24
|
|
|
|
|
694
|
|
|
6
|
24
|
|
|
24
|
|
9335
|
use Apache2::ASP::Config; |
|
|
24
|
|
|
|
|
44
|
|
|
|
24
|
|
|
|
|
14530
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#============================================================================== |
|
10
|
|
|
|
|
|
|
sub new |
|
11
|
|
|
|
|
|
|
{ |
|
12
|
0
|
|
|
0
|
0
|
|
my ($class) = @_; |
|
13
|
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
|
return bless { }, $class; |
|
15
|
|
|
|
|
|
|
}# end new() |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#============================================================================== |
|
19
|
|
|
|
|
|
|
sub parse |
|
20
|
|
|
|
|
|
|
{ |
|
21
|
0
|
|
|
0
|
1
|
|
my ($s, $doc, $root) = @_; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Start out with the |
|
24
|
|
|
|
|
|
|
SYSTEM: { |
|
25
|
0
|
|
0
|
|
|
|
$doc->{system}->{libs} ||= { }; |
|
|
0
|
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
|
if( $doc->{system}->{libs}->{lib} ) |
|
27
|
|
|
|
|
|
|
{ |
|
28
|
|
|
|
|
|
|
$doc->{system}->{libs}->{lib} = [ $doc->{system}->{libs}->{lib} ] |
|
29
|
0
|
0
|
|
|
|
|
unless ref($doc->{system}->{libs}->{lib}) eq 'ARRAY'; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
else |
|
32
|
|
|
|
|
|
|
{ |
|
33
|
0
|
|
|
|
|
|
$doc->{system}->{libs}->{lib} = [ ]; |
|
34
|
|
|
|
|
|
|
}# end if() |
|
35
|
|
|
|
|
|
|
|
|
36
|
0
|
|
0
|
|
|
|
$doc->{system}->{load_modules} ||= { }; |
|
37
|
0
|
0
|
|
|
|
|
if( $doc->{system}->{load_modules}->{module} ) |
|
38
|
|
|
|
|
|
|
{ |
|
39
|
|
|
|
|
|
|
$doc->{system}->{load_modules}->{module} = [ $doc->{system}->{load_modules}->{module} ] |
|
40
|
0
|
0
|
|
|
|
|
unless ref($doc->{system}->{load_modules}->{module}) eq 'ARRAY'; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
else |
|
43
|
|
|
|
|
|
|
{ |
|
44
|
0
|
|
|
|
|
|
$doc->{system}->{load_modules}->{module} = [ ]; |
|
45
|
|
|
|
|
|
|
}# end if() |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
|
0
|
|
|
|
$doc->{system}->{env_vars} ||= { }; |
|
48
|
0
|
0
|
|
|
|
|
if( $doc->{system}->{env_vars}->{var} ) |
|
49
|
|
|
|
|
|
|
{ |
|
50
|
|
|
|
|
|
|
$doc->{system}->{env_vars}->{var} = [ delete($doc->{system}->{env_vars}->{var}) ] |
|
51
|
0
|
0
|
|
|
|
|
unless ref($doc->{system}->{env_vars}->{var}) eq 'ARRAY'; |
|
52
|
0
|
|
|
|
|
|
my $ref = delete($doc->{system}->{env_vars}->{var}); |
|
53
|
0
|
|
|
|
|
|
$doc->{system}->{env_vars}->{var} = [ ]; |
|
54
|
0
|
|
|
|
|
|
foreach my $item ( grep { $_->{name} } @$ref ) |
|
|
0
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
{ |
|
56
|
0
|
|
|
|
|
|
push @{$doc->{system}->{env_vars}->{var}}, { $item->{name} => $item->{value} }; |
|
|
0
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
}# end foreach() |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
else |
|
60
|
|
|
|
|
|
|
{ |
|
61
|
0
|
|
|
|
|
|
$doc->{system}->{env_vars}->{var} = [ ]; |
|
62
|
|
|
|
|
|
|
}# end if() |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# Post-processor: |
|
65
|
0
|
|
0
|
|
|
|
$doc->{system}->{post_processors} ||= { }; |
|
66
|
0
|
0
|
|
|
|
|
if( $doc->{system}->{post_processors}->{class} ) |
|
67
|
|
|
|
|
|
|
{ |
|
68
|
|
|
|
|
|
|
$doc->{system}->{post_processors}->{class} = [ $doc->{system}->{post_processors}->{class} ] |
|
69
|
0
|
0
|
|
|
|
|
unless ref($doc->{system}->{post_processors}->{class}) eq 'ARRAY'; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
else |
|
72
|
|
|
|
|
|
|
{ |
|
73
|
0
|
|
|
|
|
|
$doc->{system}->{post_processors}->{class} = [ ]; |
|
74
|
|
|
|
|
|
|
}# end if() |
|
75
|
|
|
|
|
|
|
}; |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
WEB: { |
|
78
|
0
|
|
0
|
|
|
|
$doc->{web}->{request_filters} ||= { }; |
|
|
0
|
|
|
|
|
|
|
|
79
|
0
|
0
|
|
|
|
|
if( $doc->{web}->{request_filters}->{filter} ) |
|
80
|
|
|
|
|
|
|
{ |
|
81
|
|
|
|
|
|
|
$doc->{web}->{request_filters}->{filter} = [ delete($doc->{web}->{request_filters}->{filter}) ] |
|
82
|
0
|
0
|
|
|
|
|
unless ref($doc->{web}->{request_filters}->{filter}) eq 'ARRAY'; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
else |
|
85
|
|
|
|
|
|
|
{ |
|
86
|
0
|
|
|
|
|
|
$doc->{web}->{request_filters}->{filter} = [ ]; |
|
87
|
|
|
|
|
|
|
}# end if() |
|
88
|
|
|
|
|
|
|
|
|
89
|
0
|
|
0
|
|
|
|
$doc->{web}->{disable_persistence} ||= { }; |
|
90
|
0
|
0
|
|
|
|
|
if( $doc->{web}->{disable_persistence}->{location} ) |
|
91
|
|
|
|
|
|
|
{ |
|
92
|
|
|
|
|
|
|
$doc->{web}->{disable_persistence}->{location} = [ delete($doc->{web}->{disable_persistence}->{location}) ] |
|
93
|
0
|
0
|
|
|
|
|
unless ref($doc->{web}->{disable_persistence}->{location}) eq 'ARRAY'; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
else |
|
96
|
|
|
|
|
|
|
{ |
|
97
|
0
|
|
|
|
|
|
$doc->{web}->{disable_persistence}->{location} = [ ]; |
|
98
|
|
|
|
|
|
|
}# end if() |
|
99
|
|
|
|
|
|
|
}; |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
DATA_CONNECTIONS: { |
|
102
|
0
|
|
0
|
|
|
|
$doc->{data_connections} ||= { }; |
|
|
0
|
|
|
|
|
|
|
|
103
|
0
|
|
0
|
|
|
|
$doc->{data_connections}->{session} ||= { }; |
|
104
|
0
|
|
0
|
|
|
|
$doc->{data_connections}->{application} ||= { }; |
|
105
|
0
|
|
0
|
|
|
|
$doc->{data_connections}->{main} ||= { }; |
|
106
|
|
|
|
|
|
|
}; |
|
107
|
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
my $config = Apache2::ASP::Config->new( $doc, $root ); |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# Now do any post-processing: |
|
111
|
0
|
|
|
|
|
|
foreach my $class ( $config->system->post_processors ) |
|
112
|
|
|
|
|
|
|
{ |
|
113
|
0
|
|
|
|
|
|
(my $file = "$class.pm") =~ s/::/\//; |
|
114
|
0
|
0
|
|
|
|
|
require $file unless $INC{$file}; |
|
115
|
0
|
|
|
|
|
|
$config = $class->new()->post_process( $config ); |
|
116
|
|
|
|
|
|
|
}# end foreach() |
|
117
|
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
return $config; |
|
119
|
|
|
|
|
|
|
}# end parse() |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
1;# return true: |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=pod |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 NAME |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Apache2::ASP::ConfigParser - Initial Configuration parser |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
# You will never use this module. |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
This package handles the transformation of the configuration data from a simple hashref |
|
136
|
|
|
|
|
|
|
into a nicely standardized, blessed hashref. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 PUBLIC METHODS |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 parse( \%doc, $application_root ) |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Returns an instance of L. |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Converts a specially-constructed hashref into an instance of L. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Any L classes listed in the C |
|
147
|
|
|
|
|
|
|
section of the configuration will be called be called at the last moment, just before |
|
148
|
|
|
|
|
|
|
returning the configuration object. |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 BUGS
|
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
It's possible that some bugs have found their way into this release.
|
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Use RT L to submit bug reports.
|
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 HOMEPAGE
|
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Please visit the Apache2::ASP homepage at L to see examples
|
|
159
|
|
|
|
|
|
|
of Apache2::ASP in action.
|
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 AUTHOR
|
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
John Drago
|
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE
|
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Copyright 2007 John Drago, All rights reserved.
|
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
This software is free software. It may be used and distributed under the
|
|
170
|
|
|
|
|
|
|
same terms as Perl itself.
|
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=cut |
|
173
|
|
|
|
|
|
|
|