line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Apache2::ASP::ConfigFinder; |
3
|
|
|
|
|
|
|
|
4
|
25
|
|
|
25
|
|
609
|
use strict; |
|
25
|
|
|
|
|
103
|
|
|
25
|
|
|
|
|
719
|
|
5
|
25
|
|
|
25
|
|
95
|
use warnings 'all'; |
|
25
|
|
|
|
|
33
|
|
|
25
|
|
|
|
|
783
|
|
6
|
25
|
|
|
25
|
|
102
|
use Cwd 'cwd'; |
|
25
|
|
|
|
|
34
|
|
|
25
|
|
|
|
|
5937
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $CONFIGFILE = 'apache2-asp-config.xml'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#============================================================================== |
11
|
|
|
|
|
|
|
sub config_path |
12
|
|
|
|
|
|
|
{ |
13
|
25
|
|
|
25
|
1
|
1248
|
my $path = $CONFIGFILE; |
14
|
|
|
|
|
|
|
|
15
|
25
|
|
33
|
|
|
96982
|
my $root = $ENV{DOCUMENT_ROOT} || cwd(); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Try test dir: |
18
|
25
|
50
|
|
|
|
1181
|
if( -f "$root/t/conf/$CONFIGFILE" ) |
19
|
|
|
|
|
|
|
{ |
20
|
25
|
|
|
|
|
428
|
return "$root/t/conf/$CONFIGFILE"; |
21
|
|
|
|
|
|
|
}# end if() |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Start moving up: |
24
|
0
|
|
|
|
|
|
for( 1...10 ) |
25
|
|
|
|
|
|
|
{ |
26
|
0
|
|
|
|
|
|
my $path = "$root/conf/$CONFIGFILE"; |
27
|
0
|
0
|
|
|
|
|
return $path if -f $path; |
28
|
0
|
0
|
|
|
|
|
$root =~ s/\/[^\/]+$// |
29
|
|
|
|
|
|
|
or last; |
30
|
|
|
|
|
|
|
}# end for() |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
die "CANNOT FIND '$CONFIGFILE' anywhere under '$root'"; |
33
|
|
|
|
|
|
|
}# end config_path() |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1;# return true: |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |