| 1 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # This file is part of WebDyne. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # This software is copyright (c) 2026 by Andrew Speer <andrew.speer@isolutions.com.au>. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # Full license text is available at: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # <http://dev.perl.org/licenses/> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | package WebDyne::Install::Apache::Constant; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # Pragma | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 6 | ▶ | use strict qw(vars); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 6 | ▶ | use vars qw($VERSION @ISA %Constant); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 6 | ▶ | no warnings qw(uninitialized); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # Does the heavy liftying of importing into caller namespace | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | require WebDyne::Constant; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | @ISA=qw(WebDyne::Constant); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # External modules | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 6 | ▶ | use File::Find; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 6 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 6 | ▶ | use IO::File; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 6 | ▶ | use Cwd qw(realpath); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 6 | ▶ | use Env::Path; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 6 | ▶ | use WebDyne::Util; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 6 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | # Constants for our Constants module. PATH is only used as last resort | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 6 | ▶ | use constant PATH => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | /sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin /opt/sbin /opt/bin) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 6 | ]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # Need to null out some Fcntl functions under Win32 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | #use Fcntl; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | #sub Fcntl::O_NONBLOCK { 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | #sub Fcntl::O_NOCTTY { 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | # Local constants | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | our $Httpd_Bin=&httpd_bin(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | our $Apachectl_Bin=&apachectl_bin(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | our $Httpd_Config_hr=&httpd_config(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | our $Apxs_Bin=&apxs_bin(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | our $Apxs_Config_hr=&apxs_config($Apxs_Bin); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | my $ServerRoot; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # Version information | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | $VERSION='3.029'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | # Name of user httpd runs under | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | my ($apache_uname, $apache_gname, $apache_uid, $apache_gid); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | my @apache_uname=$ENV{'APACHE_UNAME'} || | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | qw(apache apache2 www wwwrun httpd httpd2 www-data webservd); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | foreach my $name (@apache_uname) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | unless ($apache_uid || $^O=~/MSWin[32|64]/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | if ($apache_uid=getpwnam($name)) {$apache_uname=$name; last} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | my @apache_gname=$ENV{'APACHE_GNAME'} || | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | qw(apache apache2 www wwwrun httpd httpd2 www-data webservd); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | foreach my $name (@apache_gname) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | unless ($apache_gid || $^O=~/MSWin[32|64]/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | if ($apache_gid=getgrnam($name)) {$apache_gname=$name; last} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 && debug("apache_uid: $apache_uid, apache_gid: $apache_gid"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | # Check we have something for Apache uname etc. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | unless ($apache_uid || $^O=~/MSWin[32|64]/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | warn('unable to determine Apache uname - please supply via APACHE_UNAME environment variable') | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | unless ($apache_gid || $^O=~/MSWin[32|64]/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | warn('unable to determine Apache gname - please supply via APACHE_GNAME environment variable') | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | # Get mod_perl file and modules library location | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | my $dir_apache_modules=&dir_apache_modules(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | my $file_mod_perl_lib=&file_mod_perl_lib($dir_apache_modules); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | # Is mod_perl2/1 installed | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | my $mp2_installed=&mp2_installed(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | # Real deal | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | %Constant=( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | # Mod_perl1/2 installed | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | MP2_INSTALLED => $mp2_installed, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | # Binary | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | HTTPD_BIN => $Httpd_Bin, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | APACHECTL_BIN => $Apachectl_Bin, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | APXS_BIN => $Apxs_Bin, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | # Config file templates and final names, delimiter if inserted into master httpd.conf | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | FILE_WEBDYNE_CONF_TEMPLATE => 'webdyne.conf.inc', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | FILE_WEBDYNE_CONF => 'webdyne.conf', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | FILE_WEBDYNE_CONF_PL_TEMPLATE => 'webdyne_conf.pl.inc', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | FILE_WEBDYNE_CONF_PL => 'webdyne_conf.pl', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | FILE_APACHE_CONF_TEMPLATE => 'apache.conf.inc', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | FILE_APACHE_CONF_DELIM => '#*WebDyne*', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | FILE_MOD_PERL_1_99_COMPAT => 'webdyne-mod_perl-1_99-compat.pl', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | # Get apache directory name | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | DIR_APACHE_CONF => &dir_apache_conf(), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | DIR_APACHE_MODULES => $dir_apache_modules, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | # Mod_perl library name | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | FILE_MOD_PERL_LIB => $file_mod_perl_lib, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | # Need apache uid and gid, as some dirs will be chowned to this | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | # at install time | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | APACHE_UNAME => $apache_uname, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | APACHE_GNAME => $apache_gname, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | APACHE_UID => $apache_uid, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | APACHE_GID => $apache_gid, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | # SELinux context for cache directory | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | SELINUX_CONTEXT_HTTPD => 'httpd_sys_content_t', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | SELINUX_CONTEXT_LIB => 'lib_t', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | SELINUX_ENABLED_BIN => &find_bin('selinuxenabled'), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | SELINUX_CHCON_BIN => &find_bin('chcon'), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | SELINUX_SEMANAGE_BIN => &find_bin('semanage'), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | # Perl shared lib files that need to be checked for SELinux context | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | SELINUX_SO_CHECK => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | IO => 'IO/IO.so', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 'Digest::MD5' => 'Digest/MD5/MD5.so', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | Fcntl => 'Fcntl/Fcntl.so', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 'Time::HiRes' => 'Time/HiRes/HiRes.so', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | Storable => 'Storable/Storable.so', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 'File::Glob' => 'File/Glob/Glob.so', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | Opcode => 'Opcode/Opcode.so', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 'Data::Dumper' => 'Dumper/Dumper.so' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | # Server config | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | %{$Apxs_Config_hr || {}}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | %{$Httpd_Config_hr}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | # Get absolute binary file location | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 6 | ▶ | sub httpd_bin { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
httpd_bin: called CC=11 SCAR=29.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | # If in Win32 need to get location of Apache from reg. Not much error checking | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | # because not fatal if reg key not found etc. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 6 | 0 && debug(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 6 | my ($path, @name_bin); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 6 | ▶ | if ($^O=~/MSWin[32|64]/) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | # Windows | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | 0 && debug("detected MS Win: $^O"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | require Win32::TieRegistry; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | my $reg_ix=tie( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | my %reg, 'Win32::TieRegistry', 'HKEY_LOCAL_MACHINE\Software\Apache Group\Apache' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | my $version=(sort {$b cmp $a} keys %reg)[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | unless ($version) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | $reg_ix=tie( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | %reg, 'Win32::TieRegistry', 'HKEY_LOCAL_MACHINE\Software\Apache Software Foundation\Apache' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | $version=(sort {$b cmp $a} keys %reg)[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | 0 && debug("registry says version: $version"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | $path=($ServerRoot=$reg{$version}->{'ServerRoot'}); #|| | |||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | # last resorts. blech | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | #'C:\Apache;C:\Apache~1;C:\Apache2;C:\Apache2.2;C:\Progra~1\Apache;C:\Progra~1\Apache2;C:\Progra~1\Apache~1;'. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | #'D:\Apache;D:\Apache~1;D:\Apache2;D:\Apache2.2;D:\Progra~1\Apache;D:\Progra~1\Apache2;D:\Progra~1\Apache~1;'. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | #'E:\Apache;E:\Apache~1;E:\Apache2;E:\Apache2.2;E:\Progra~1\Apache;E:\Progra~1\Apache2;E:\Progra~1\Apache~1;'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | # Some Apache distro's use '/bin/' after ServerRoot | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | if ($path) {$path=join(Env::Path->PathSeparator, File::Spec->catdir($path, 'bin'))} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | # Various names for Apache under Windows | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | @name_bin=qw(Apache.exe Apache2.exe httpd.exe httpd2.exe); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | # Add some hard coded paths as last resort options, will work if su'd to root | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | # without getting root's path | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 6 | $path=join(Env::Path->PathSeparator, $ENV{'PATH'}, @{+PATH}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 6 | @name_bin=qw(httpd httpd2 httpd2.2 httpd2.4 apache apache2 apache2.2 apache2.4); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 6 | 0 && debug("apache final search path: '$path'"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 6 | 0 && debug('apache names %s', Dumper(\@name_bin)); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | # Find the httpd bin file | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 6 | my $httpd_bin; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 6 | ▶ | unless ($httpd_bin=$ENV{'HTTPD_BIN'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 2 | my @dir=grep {-d $_} split(Env::Path->PathSeparator, $path); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 2 | my %dir=map {$_ => 1} @dir; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 2 | DIR: foreach my $dir (@dir) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 32 | ▶ | next unless delete $dir{$dir}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 16 | ▶ | next unless -d $dir; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 16 | 0 && debug("searching dir: $dir"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 16 | foreach my $name_bin (@name_bin) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 128 | ▶ | if (-f File::Spec->catfile($dir, $name_bin)) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | $httpd_bin=File::Spec->catfile($dir, $name_bin); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | last DIR; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 6 | 0 && debug("httpd_bin returning: $httpd_bin"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | # Warn if unable to find | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 6 | ▶ | unless (-f $httpd_bin) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 2 | warn('unable to find/determine Apache binary location - please supply via HTTPD_BIN environment variable'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | # Return | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 4 | return File::Spec->canonpath($httpd_bin); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 12 | ▶ | sub find_bin { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_bin: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 12 | my $bin=shift(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 12 | my $path=join(Env::Path->PathSeparator, $ENV{'PATH'}, @{+PATH}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 12 | 0 && debug("find_bin $bin, path: $path"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 12 | my $fn; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 12 | ▶ | unless ($fn=$ENV{"${bin}_BIN"}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 12 | my @dir=grep {-d $_} split(Env::Path->PathSeparator, $path); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 12 | my %dir=map {$_ => 1} @dir; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 12 | foreach my $dir (@dir) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 68 | ▶ | next unless delete $dir{$dir}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 68 | ▶ | next unless -d $dir; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 68 | 0 && debug("searching dir: $dir"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 68 | ▶ | if (-f File::Spec->catfile($dir, $bin)) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 4 | $fn=File::Spec->catfile($dir, $bin); last; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | # Return | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 12 | 0 && debug("find_bin returning: $fn"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 12 | ▶ | return $fn ? File::Spec->canonpath($fn) : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 8 | ▶ | sub find_first_bin { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_first_bin: called CC=10 SCAR=39.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 8 | my ($env_ar, $name_ar)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 8 | ▶ | foreach my $env (@{$env_ar || []}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$env_ar || []
MC/DC0%0/1
$env_ar || []
$env_ar
Truth table50%1/2
A
A= $env_ar
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 8 | ▶ | next unless $ENV{$env}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 8 | ▶ | return File::Spec->canonpath($ENV{$env}) if -f $ENV{$env}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | my $path=join(Env::Path->PathSeparator, $ENV{'PATH'}, @{+PATH}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | my @dir=grep {-d $_} split(Env::Path->PathSeparator, $path); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | my %dir=map {$_ => 1} @dir; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | foreach my $dir (@dir) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | ▶ | next unless delete $dir{$dir}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | foreach my $name (@{$name_ar || []}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$name_ar || []
MC/DC0%0/1
$name_ar || []
$name_ar
Truth table0%0/2
A
A= $name_ar
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | my $fn=File::Spec->catfile($dir, $name); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | ▶ | return File::Spec->canonpath($fn) if -f $fn; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 20 | ▶ | sub command_output { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
command_output: called CC=5 SCAR=17.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 20 | my ($bin, @arg)=@_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 20 | ▶ | return unless $bin && -f $bin; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$bin and -f $bin
MC/DC0%0/2
$bin and -f $bin
$bin
-f $bin
Truth table33%1/3
A and B
A= $binB= -f $bin
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 20 | my @out; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 20 | open(my $stderr_save, '>&', \*STDERR); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 20 | open(STDERR, '>', File::Spec->devnull()); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 20 | ▶ | if (open(my $fh, '-|', $bin, @arg)) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 20 | @out=<$fh>; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 20 | close($fh); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 20 | ▶ | open(STDERR, '>&', $stderr_save) if $stderr_save; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 20 | return @out; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 4 | ▶ | sub apachectl_bin { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
apachectl_bin: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 4 | my $apachectl_bin=find_first_bin( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | [qw(APACHECTL_BIN APACHECTL APACHE2CTL)], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | [qw(apachectl apache2ctl)] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 4 | 0 && debug("apachectl_bin returning: $apachectl_bin"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 4 | return $apachectl_bin; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 4 | ▶ | sub apxs_bin { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
apxs_bin: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 4 | my $apxs_bin=find_first_bin( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | [qw(APXS_BIN APXS APACHE_TEST_APXS)], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | [qw(apxs apxs2 apxs2.4)] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 4 | 0 && debug("apxs_bin returning: $apxs_bin"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 4 | return $apxs_bin; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 4 | ▶ | sub apxs_config { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
apxs_config: called CC=6 SCAR=18.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 4 | ▶ | my $apxs_bin=shift() || return {}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || (return {})
MC/DC0%0/1
shift() || (return {})
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 4 | my %config; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 4 | foreach my $key (qw(LIBEXECDIR SYSCONFDIR HTTPD_ROOT SERVER_CONFIG_FILE)) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 16 | my @out=command_output($apxs_bin, '-q', $key); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 16 | ▶ | next unless @out; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 8 | chomp(my $value=$out[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 8 | ▶ | next unless defined($value) && length($value); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $value and length $value
MC/DC0%0/2
defined $value and length $value
defined $value
length $value
Truth table33%1/3
A and B
A= defined $valueB= length $value
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 8 | $config{"APXS_$key"}=$value; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 4 | 0 && debug('apxs_config: %s', Dumper(\%config)); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 4 | return \%config; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 4 | ▶ | sub httpd_config { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
httpd_config: called CC=13 SCAR=29.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | # Return if neither httpd nor apachectl was found. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 4 | 0 && debug(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 4 | ▶ | return unless $Httpd_Bin || $Apachectl_Bin; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$WebDyne::Install::Apache::Constant::Httpd_Bin or $WebDyne::Install::Apache::Constant::Apachectl_Bin
MC/DC0%0/2
$WebDyne::Install::Apache::Constant::Httpd_Bin or $WebDyne::Install::Apache::Constant::Apachectl_Bin
$WebDyne::Install::Apache::Constant::Httpd_Bin
$WebDyne::Install::Apache::Constant::Apachectl_Bin
Truth table33%1/3
A or B
A= $WebDyne::Install::Apache::Constant::Httpd_BinB= $WebDyne::Install::Apache::Constant::Apachectl_Bin
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | # Need to get httpd config as series of key/val pairs | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 4 | my %config; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 4 | my $devnull=File::Spec->devnull(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 4 | my @httpd_config=command_output($Httpd_Bin, '-V'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 4 | ▶ | @httpd_config=command_output($Apachectl_Bin, '-V') unless @httpd_config; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 4 | 0 && debug('httpd_config: %s', Dumper(\@httpd_config)); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | # Go through | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 4 | foreach my $httpd_config (@httpd_config) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 12 | ▶ | if ($httpd_config=~/Apache\/(\d+\.\d+)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 4 | $config{'HTTPD_VER'}=$1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 4 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 8 | ▶ | next unless ($httpd_config=~/\s*\-D\s*(.*)/); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 8 | my ($key, $value)=split(/\=/, $1); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 8 | $key=~s/\s+.*$//g; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 8 | ▶ | $value ||= ''; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$value ||= ""
MC/DC0%0/1
$value ||= ""
$value
Truth table50%1/2
A
A= $value
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 8 | $value=~s/^\"//; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 8 | $value=~s/\"$//; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 8 | ▶ | $key=~/^HTTPD/ || ($key="HTTPD_${key}"); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 8 | ▶ | $config{$key}=$value || 1; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$value || 1
MC/DC0%0/1
$value || 1
$value
Truth table50%1/2
A
A= $value
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | # In windows HTTPD_ROOT does not always match actual installed root path, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | # so override if possible | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 4 | ▶ | my $httpd_dn=($config{'HTTPD_ROOT'}=$ServerRoot || $config{'HTTPD_ROOT'}); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$ServerRoot || $config{'HTTPD_ROOT'}
MC/DC0%0/2
$ServerRoot || $config{'HTTPD_ROOT'}
$ServerRoot
$config{'HTTPD_ROOT'}
Truth table33%1/3
A || B
A= $ServerRootB= $config{'HTTPD_ROOT'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | # Last resort - if does not exist use apache bin location as ref for | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | # HTTPD_ROOT | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 4 | ▶ | unless (-d $httpd_dn) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | 0 && debug('using last resort to find httpd_dn'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | $config{'HTTPD_ROOT'}=do { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | my $dn=File::Spec->catdir( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | (File::Spec->splitpath($Httpd_Bin))[1], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | File::Spec->updir()); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | ▶ | (-d $dn) && ($dn=realpath($dn)); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | $dn; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 4 | 0 && debug('httpd_dn set to: %s', $config{'HTTPD_ROOT'}); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | # And return the config | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 4 | return \%config; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 4 | ▶ | sub dir_apache_conf { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dir_apache_conf: called CC=10 SCAR=24.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | # Get Apache config dir, ensure is absolute | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 4 | 0 && debug(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 4 | my $apache_conf_dn; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 4 | ▶ | unless ($apache_conf_dn=$ENV{'DIR_APACHE_CONF'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 4 | ▶ | if (my $sysconf_dn=$Apxs_Config_hr->{'APXS_SYSCONFDIR'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 4 | $apache_conf_dn=$sysconf_dn; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | $apache_conf_dn=$Httpd_Config_hr->{'HTTPD_SERVER_CONFIG_FILE'}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 4 | my $apache_conf_fn=(File::Spec->splitpath($apache_conf_dn))[2]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 4 | ▶ | $apache_conf_dn=~s/\Q$apache_conf_fn\E$// if $apache_conf_fn=~/\.conf$/; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | #$apache_conf_dn=(File::Spec->splitpath( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | # $Httpd_Config_hr->{'HTTPD_SERVER_CONFIG_FILE'}))[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 4 | 0 && debug("apache_conf_fn initital value: $apache_conf_dn"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 4 | ▶ | unless ($apache_conf_dn=~/^\//) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | 0 && debug("apache_conf_dn path appears relative - prepending HTTPD_ROOT"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | $apache_conf_dn=File::Spec->catdir( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | $Httpd_Config_hr->{'HTTPD_ROOT'}, $apache_conf_dn | |||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 4 | 0 && debug('apache_conf_dn appears fully qualified - leaving intact'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | # Prefer distro include directories when available. Debian-style | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | # systems keep the source file in conf-available and enable it through | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | # conf-enabled; Fedora/RHEL-style systems commonly include conf.d. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 4 | my @include_dn=( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | [ 'conf.d' ], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | [ File::Spec->catdir(File::Spec->updir(), 'conf.d') ], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | [ 'conf-available', 'conf-enabled' ], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | [ File::Spec->catdir(File::Spec->updir(), 'conf-available'), File::Spec->catdir(File::Spec->updir(), 'conf-enabled') ], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 4 | foreach my $dn_ar (@include_dn) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 12 | my ($dn, $enabled_dn)=@{$dn_ar}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 12 | 0 && debug("looking for conf.d path: $dn"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 12 | my $test_dn=File::Spec->canonpath( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | File::Spec->catdir($apache_conf_dn, $dn)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 12 | 0 && debug("testing: $test_dn"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 12 | ▶ | if (-d $test_dn) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 4 | ▶ | if ($enabled_dn) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 4 | my $test_enabled_dn=File::Spec->canonpath( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | File::Spec->catdir($apache_conf_dn, $enabled_dn)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 4 | ▶ | $Httpd_Config_hr->{'DIR_APACHE_CONF_ENABLED'}=realpath($test_enabled_dn) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | if -d $test_enabled_dn; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 4 | $apache_conf_dn=realpath($test_dn); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 4 | 0 && debug("found, setting apache_conf_dn: $apache_conf_dn"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 4 | $Httpd_Config_hr->{'HTTPD_SERVER_CONFIG_SKIP'}=1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 4 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 8 | 0 && debug('not found'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | 0 && debug('setting apache_conf_dn from %ENV'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 4 | 0 && debug("apache_conf_dn set to: $apache_conf_dn"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | # Warn if not found | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 4 | ▶ | unless (-d $apache_conf_dn) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | warn('unable to find/determine Apache conf directory - please supply via DIR_APACHE_CONF environment variable'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | # Return it | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 4 | return $apache_conf_dn; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 4 | ▶ | sub dir_apache_modules { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dir_apache_modules: called CC=5 SCAR=16.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | # Get Apache config dir, ensure is absolute | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 4 | 0 && debug(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | my @dn=( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | $Apxs_Config_hr->{'APXS_LIBEXECDIR'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | File::Spec->catdir( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | $Httpd_Config_hr->{'HTTPD_ROOT'}, 'modules' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | File::Spec->catdir( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 4 | $Httpd_Config_hr->{'HTTPD_ROOT'}, 'libexec' | |||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | # last resorts, blech | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | '/usr/lib/apache2/modules', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | '/usr/lib/apache2.2/modules', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | '/usr/lib/httpd/modules', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | '/usr/lib/apache2', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | '/usr/lib/apache2.2', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | '/usr/local/lib', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | '/usr/local/lib64', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | '/usr/lib', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | '/usr/lib64' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | # Check for modules | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 4 | my $apache_modules_dn; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 4 | ▶ | unless ($apache_modules_dn=$ENV{'DIR_APACHE_MODULES'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 4 | foreach my $dn (@dn) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 4 | 0 && debug("looking for path: $dn"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 4 | ▶ | if (-d $dn) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 4 | $apache_modules_dn=$dn; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 4 | 0 && debug("found, setting apache_modules_dn to: $dn"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 4 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 4 | ▶ | $apache_modules_dn ||= 'modules'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$apache_modules_dn ||= "modules"
MC/DC0%0/1
$apache_modules_dn ||= "modules"
$apache_modules_dn
Truth table50%1/2
A
A= $apache_modules_dn
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | 0 && debug('setting apache_modules_dn from %ENV'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 4 | 0 && debug("apache_modules_dn set to: $apache_modules_dn"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | # Warn if not found. Update - don't do this anymore, just warn later if mod_perl lib not found, which | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | # used this routine to find potential module storage dir. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | #unless (-d $apache_modules_dn) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | #warn('unable to find/determine Apache modules directory - please supply via DIR_APACHE_MODULES environment variable'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | #} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | # Return it | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 4 | return $apache_modules_dn; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 4 | ▶ | sub file_mod_perl_lib { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file_mod_perl_lib: called CC=7 SCAR=29.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | # Get the name of the mod_perl library | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 4 | my $dn=shift(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 4 | 0 && debug("looking for mod_perl dn: $dn"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 4 | my $mod_perl_cn; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 4 | ▶ | unless ($mod_perl_cn=$ENV{'FILE_MOD_PERL_LIB'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | foreach my $fn (qw(libperl mod_perl mod_perl2 mod_perl2.2 mod_perl-2 mod_perl-2.2)) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | foreach my $ext (qw(so dll)) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | my $cn=File::Spec->catfile($dn, "$fn.$ext"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | 0 && debug("looking for cn: $cn"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | ▶ | if (-f $cn) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 0 | $mod_perl_cn=$cn; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | 0 && debug('not found'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | ▶ | last if $mod_perl_cn; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 4 | 0 && debug("setting mod_perl_cn from %ENV") | |||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 4 | 0 && debug("mod_perl_cn set to: $mod_perl_cn"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 4 | ▶ | unless (-f $mod_perl_cn) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | warn('unable to find/determine mod_perl library - please supply via FILE_MOD_PERL_LIB environment variable'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 4 | return $mod_perl_cn; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 4 | ▶ | sub mp2_installed { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mp2_installed: called CC=11 SCAR=28.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 4 | local $SIG{__DIE__}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 4 | eval {require Apache2}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 4 | eval {require mod_perl}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 4 | eval {require mod_perl2}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | 4 | ▶ | eval {undef} if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 4 | my $mp2_installed; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 4 | ▶ | if (($mod_perl::VERSION || $mod_perl2::VERSION || $ENV{MOD_PERL_API_VERSION}) >= 1.99) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition33%2/6
$mod_perl::VERSION || $mod_perl2::VERSION || $ENV{'MOD_PERL_API_VERSION'}
$mod_perl::VERSION or $mod_perl2::VERSION
MC/DC0%0/3
$mod_perl::VERSION || $mod_perl2::VERSION || $ENV{'MOD_PERL_API_VERSION'}
$mod_perl::VERSION
$mod_perl2::VERSION
$ENV{'MOD_PERL_API_VERSION'}
Truth table25%1/4
A or B || C
A= $mod_perl::VERSIONB= $mod_perl2::VERSIONC= $ENV{'MOD_PERL_API_VERSION'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | $mp2_installed=1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | ▶ | elsif (($mod_perl::VERSION || $mod_perl2::VERSION || $ENV{MOD_PERL_API_VERSION}) >= 1) { | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%2/6
$mod_perl::VERSION || $mod_perl2::VERSION || $ENV{'MOD_PERL_API_VERSION'}
$mod_perl::VERSION or $mod_perl2::VERSION
MC/DC0%0/3
$mod_perl::VERSION || $mod_perl2::VERSION || $ENV{'MOD_PERL_API_VERSION'}
$mod_perl::VERSION
$mod_perl2::VERSION
$ENV{'MOD_PERL_API_VERSION'}
Truth table25%1/4
A or B || C
A= $mod_perl::VERSIONB= $mod_perl2::VERSIONC= $ENV{'MOD_PERL_API_VERSION'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | $mp2_installed=0 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | elsif ($file_mod_perl_lib) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | # Last resort - mod_perl libary exists, but we couldn't load | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 4 | $mp2_installed=0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 4 | my $version=qx($Httpd_Bin -v); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 4 | ▶ | if ($version=~/(\d+)\.(\d+)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 4 | $version=$1 . $2; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 4 | ▶ | if ($version >= 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 4 | $mp2_installed=1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 4 | 0 && debug("mp2_installed: $mp2_installed"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 4 | return $mp2_installed; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | # Done | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||