| 1 | |||||||||||||||||||||||||||||||||||||||
| 2 | package | ||||||||||||||||||||||||||||||||||||||
| 3 | ASP4::ConfigFinder; | ||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||
| 5 | 15 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 6 | 15 | ▶ | use warnings 'all'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 7 | 15 | ▶ | use Cwd 'fastcwd'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||
| 9 | 15 | our $CONFIGFILE = 'asp4-config.json'; | |||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||
| 12 | sub config_path | ||||||||||||||||||||||||||||||||||||||
| 13 | 31020 | ▶ | { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
config_path: called CC=8 SCAR=32.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 14 | 31020 | my $path = $CONFIGFILE; | |||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||
| 16 | 31020 | ▶ | my $root = do { ($ENV{REMOTE_ADDR} || '') eq '' ? fastcwd() : $ENV{DOCUMENT_ROOT} || fastcwd() }; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
$ENV{'REMOTE_ADDR'} || ''
$ENV{"DOCUMENT_ROOT"} or fastcwd()
MC/DC0%0/1
$ENV{'REMOTE_ADDR'} || ''
$ENV{'REMOTE_ADDR'}
MC/DC0%0/2
$ENV{"DOCUMENT_ROOT"} or fastcwd()
$ENV{"DOCUMENT_ROOT"}
fastcwd()
Truth table50%1/2
A
A= $ENV{'REMOTE_ADDR'}
Truth table0%0/3
A or B
A= $ENV{"DOCUMENT_ROOT"}B= fastcwd()
| |||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||
| 18 | # Try test dir: | ||||||||||||||||||||||||||||||||||||||
| 19 | 31020 | ▶ | if( -f "$root/t/conf/$CONFIGFILE" ) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 20 | { | ||||||||||||||||||||||||||||||||||||||
| 21 | 31020 | return "$root/t/conf/$CONFIGFILE"; | |||||||||||||||||||||||||||||||||||||
| 22 | }# end if() | ||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||
| 24 | # Start moving up: | ||||||||||||||||||||||||||||||||||||||
| 25 | 0 | for( 1...10 ) | |||||||||||||||||||||||||||||||||||||
| 26 | { | ||||||||||||||||||||||||||||||||||||||
| 27 | 0 | my $path = "$root/conf/$CONFIGFILE"; | |||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | return $path if -f $path; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | $root =~ s/\/[^\/]+$// | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 30 | or last; | ||||||||||||||||||||||||||||||||||||||
| 31 | }# end for() | ||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||
| 33 | 0 | die "CANNOT FIND '$CONFIGFILE' anywhere under '$root'"; | |||||||||||||||||||||||||||||||||||||
| 34 | }# end config_path() | ||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||
| 36 | 15 | 1;# return true: | |||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||