| 1 | package GBrowseGuessDirectories; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use IO::Socket::INET; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use File::Spec; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 2 | my $PREFIX; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | sub prefix { | ||||||||||||||||||||||||||||
| 9 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
prefix: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 10 | 3 | my $d = $PREFIX; | |||||||||||||||||||||||||||
| 11 | 3 | ▶ | $PREFIX = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 12 | 3 | return $d; | |||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | # this package never gets installed - it's just used by Makefile.PL | ||||||||||||||||||||||||||||
| 16 | sub conf { | ||||||||||||||||||||||||||||
| 17 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
conf: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 18 | 0 | ▶ | return File::Spec->catfile($PREFIX,'etc','gbrowse2') if $PREFIX; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 0 | ▶ | if ($^O =~ /mswin/i) { # windows system | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | 0 | return File::Spec->catfile('C:','Program Files','GBrowse2','conf'); | |||||||||||||||||||||||||||
| 22 | } else { | ||||||||||||||||||||||||||||
| 23 | 0 | for ( | |||||||||||||||||||||||||||
| 24 | '/etc', | ||||||||||||||||||||||||||||
| 25 | '/usr/etc', | ||||||||||||||||||||||||||||
| 26 | '/usr/local/etc', | ||||||||||||||||||||||||||||
| 27 | ) { | ||||||||||||||||||||||||||||
| 28 | 0 | ▶ | return File::Spec->catfile($_,'gbrowse2') if -d $_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | 0 | ▶ | return File::Spec->catfile($self->prefix || '/usr/local/etc','gbrowse2'); # fallback | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->prefix || '/usr/local/etc'
MC/DC0%0/1
$self->prefix || '/usr/local/etc'
$self->prefix
Truth table0%0/2
A
A= $self->prefix
| |||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | sub etc { | ||||||||||||||||||||||||||||
| 35 | 1 | ▶ | shift; | ||||||||||||||||||||||||||
|
Subroutine
etc: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 36 | 1 | ▶ | return File::Spec->catfile($PREFIX,'etc') if $PREFIX; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | 1 | return '/etc'; # no exceptions | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | sub tmp { | ||||||||||||||||||||||||||||
| 41 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
tmp: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 42 | 0 | ▶ | return File::Spec->catfile($PREFIX,'tmp','gbrowse2') if $PREFIX; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | 0 | ▶ | return '/srv/gbrowse2/tmp' if $ENV{DEB_BUILD_ARCH}; # FHS system | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 44 | 0 | ▶ | return '/var/tmp/gbrowse2' if -e '/var/tmp' && -w '/var/tmp'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-e "/var/tmp" and -w "/var/tmp"
MC/DC0%0/2
-e "/var/tmp" and -w "/var/tmp"
-e "/var/tmp"
-w "/var/tmp"
Truth table0%0/3
A and B
A= -e "/var/tmp"B= -w "/var/tmp"
| |||||||||||||||||||||||||||||
| 45 | 0 | return File::Spec->catfile(File::Spec->tmpdir,'gbrowse2'); | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | sub persistent { | ||||||||||||||||||||||||||||
| 49 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
persistent: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 50 | 0 | ▶ | return '/srv/gbrowse2' if $ENV{DEB_BUILD_ARCH}; # FHS system | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 0 | ▶ | my $prefix = $self->prefix || '/var'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->prefix || '/var'
MC/DC0%0/1
$self->prefix || '/var'
$self->prefix
Truth table0%0/2
A
A= $self->prefix
| |||||||||||||||||||||||||||||
| 52 | 0 | return File::Spec->catfile($prefix,'lib','gbrowse2'); | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | sub databases { | ||||||||||||||||||||||||||||
| 56 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
databases: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 57 | 0 | return File::Spec->catfile($self->persistent,'databases'); | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | sub apache { | ||||||||||||||||||||||||||||
| 61 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
apache: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 62 | 0 | ▶ | return -x '/usr/sbin/httpd' ? '/usr/sbin/httpd' | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 63 | : -x '/usr/sbin/apache2' ? '/usr/sbin/apache2' | ||||||||||||||||||||||||||||
| 64 | : -x '/usr/sbin/apache' ? '/usr/sbin/apache' | ||||||||||||||||||||||||||||
| 65 | : undef; | ||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | sub apache_root { | ||||||||||||||||||||||||||||
| 69 | 1 | ▶ | if ($^O =~ /mswin/i) { # windows system | ||||||||||||||||||||||||||
|
Subroutine
apache_root: called CC=6 SCAR=23.5
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | 0 | for ( | |||||||||||||||||||||||||||
| 71 | 'C:/Program Files/Apache Software Foundation/Apache2.5', | ||||||||||||||||||||||||||||
| 72 | 'C:/Program Files/Apache Software Foundation/Apache2.4', | ||||||||||||||||||||||||||||
| 73 | 'C:/Program Files/Apache Software Foundation/Apache2.3', | ||||||||||||||||||||||||||||
| 74 | 'C:/Program Files/Apache Software Foundation/Apache2.2', | ||||||||||||||||||||||||||||
| 75 | 'C:/Program Files/Apache Software Foundation/Apache2.1', | ||||||||||||||||||||||||||||
| 76 | 'C:/Program Files/Apache Group/Apache2', | ||||||||||||||||||||||||||||
| 77 | 'C:/Program Files/Apache Group/Apache', | ||||||||||||||||||||||||||||
| 78 | 'C:/Apache/conf', | ||||||||||||||||||||||||||||
| 79 | 'C:/Apache2/conf') { | ||||||||||||||||||||||||||||
| 80 | 0 | ▶ | return $_ if -d $_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | } else { | ||||||||||||||||||||||||||||
| 83 | 1 | for ( | |||||||||||||||||||||||||||
| 84 | '/usr/local/apache2', # standard apache2 install | ||||||||||||||||||||||||||||
| 85 | '/usr/local/apache', # standard apache install | ||||||||||||||||||||||||||||
| 86 | '/opt/apache2', | ||||||||||||||||||||||||||||
| 87 | '/opt/apache', | ||||||||||||||||||||||||||||
| 88 | ) { | ||||||||||||||||||||||||||||
| 89 | 4 | ▶ | return $_ if -d $_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | 1 | return; | |||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | sub htdocs { | ||||||||||||||||||||||||||||
| 96 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
htdocs: called CC=7 SCAR=20.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 97 | 1 | local $^W = 0; | |||||||||||||||||||||||||||
| 98 | 1 | ▶ | return File::Spec->catfile($PREFIX,'htdocs') if $PREFIX; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 1 | ▶ | return '/srv/gbrowse2/htdocs' if $ENV{DEB_BUILD_ARCH}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 101 | 1 | my $root = $self->apache_root; | |||||||||||||||||||||||||||
| 102 | 1 | foreach ('htdocs','html') { | |||||||||||||||||||||||||||
| 103 | 2 | ▶ | return File::Spec->catfile($root,$_) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 104 | if -e File::Spec->catfile($root,$_); | ||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | 1 | for ( | |||||||||||||||||||||||||||
| 108 | '/var/www/html', # RedHat linux | ||||||||||||||||||||||||||||
| 109 | '/var/www/htdocs', # Slackware linux | ||||||||||||||||||||||||||||
| 110 | '/var/www', # Ubuntu/debian | ||||||||||||||||||||||||||||
| 111 | '/var/www', # Ubuntu | ||||||||||||||||||||||||||||
| 112 | '/Library/Webserver/Documents', # MacOSX | ||||||||||||||||||||||||||||
| 113 | ) { | ||||||||||||||||||||||||||||
| 114 | 5 | ▶ | return File::Spec->catfile($_,'gbrowse2') if -d $_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | 1 | return '/usr/local/apache/htdocs'; # fallback | |||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | sub cgibin { | ||||||||||||||||||||||||||||
| 120 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
cgibin: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 121 | 0 | my $root = $self->apache_root; | |||||||||||||||||||||||||||
| 122 | 0 | foreach ('cgi-bin','cgi-perl','cgi') { | |||||||||||||||||||||||||||
| 123 | 0 | ▶ | return File::Spec->catfile($root,$_) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 124 | if -e File::Spec->catfile($root,$_); | ||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||
| 126 | 0 | for ( | |||||||||||||||||||||||||||
| 127 | '/var/www/cgi-bin', # RedHat & Slackware linux | ||||||||||||||||||||||||||||
| 128 | '/usr/lib/cgi-bin', # Ubuntu/debian | ||||||||||||||||||||||||||||
| 129 | '/Library/Webserver/CGI-Executables', # MacOSX | ||||||||||||||||||||||||||||
| 130 | '/usr/lib/cgi-bin', # Ubuntu | ||||||||||||||||||||||||||||
| 131 | ) { | ||||||||||||||||||||||||||||
| 132 | 0 | ▶ | return "$_/gb2" if -d $_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||
| 134 | 0 | return '/usr/local/apache/cgi-bin/gb2'; #fallback | |||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | # try a few ports until we find an open one | ||||||||||||||||||||||||||||
| 138 | sub portdemo { | ||||||||||||||||||||||||||||
| 139 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
portdemo: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 140 | 0 | my @candidates = (80,8000,8080,8001,8008,8081,8888,8181); | |||||||||||||||||||||||||||
| 141 | 0 | for my $port (@candidates) { | |||||||||||||||||||||||||||
| 142 | 0 | my $h = IO::Socket::INET->new(LocalPort=>$port); | |||||||||||||||||||||||||||
| 143 | 0 | ▶ | return $port if $h; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | sub wwwuser { | ||||||||||||||||||||||||||||
| 148 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
wwwuser: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 149 | 0 | for (qw(www-data www httpd apache apache2 System nobody )) { | |||||||||||||||||||||||||||
| 150 | 0 | ▶ | return $_ if getpwnam($_); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | # fallback -- user current real user | ||||||||||||||||||||||||||||
| 153 | 0 | return (getpwuid($<))[0]; | |||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | sub installconf { | ||||||||||||||||||||||||||||
| 157 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
installconf: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 158 | 0 | return 'y'; | |||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | sub installetc { | ||||||||||||||||||||||||||||
| 162 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
installetc: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 163 | 0 | return 'y'; | |||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | sub apachemodules { | ||||||||||||||||||||||||||||
| 167 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
apachemodules: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 168 | 0 | my $root = $self->apache_root; | |||||||||||||||||||||||||||
| 169 | 0 | foreach ('modules','libexec') { | |||||||||||||||||||||||||||
| 170 | 0 | ▶ | return File::Spec->catfile($root,$_) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 171 | if -d File::Spec->catfile($root,$_); | ||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | 0 | ▶ | return '/etc/httpd/modules' if -d '/etc/httpd/modules'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | 0 | for my $first ('/usr/lib','/usr/share', | |||||||||||||||||||||||||||
| 178 | '/usr/local/lib','/usr/local/share') { | ||||||||||||||||||||||||||||
| 179 | 0 | for my $second ('apache','apache2') { | |||||||||||||||||||||||||||
| 180 | 0 | for my $third ('modules','libexec') { | |||||||||||||||||||||||||||
| 181 | 0 | my $candidate = File::Spec->catfile($first,$second,$third); | |||||||||||||||||||||||||||
| 182 | 0 | ▶ | return $candidate if -d $candidate; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | 0 | return '/usr/lib/apache/modules'; #fallback | |||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | # most (all?) distributions have a way to add config file snippets | ||||||||||||||||||||||||||||
| 190 | # to httpd.conf without modifying the main file | ||||||||||||||||||||||||||||
| 191 | sub apache_includes { | ||||||||||||||||||||||||||||
| 192 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
apache_includes: called CC=5 SCAR=17.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 193 | 1 | ▶ | return '/etc/apache2/other' if -d '/etc/apache2/other'; # why cant macos do things like everybody else? | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 194 | 1 | ▶ | return '/etc/apache2/conf.d' if -d '/etc/apache2/conf.d'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 195 | 1 | ▶ | return '/etc/apache/conf.d' if -d '/etc/apache/conf.d'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 196 | 1 | ▶ | return '/etc/httpd/conf.d' if -d '/etc/httpd/conf.d'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 197 | 1 | return; | |||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | 2 | 1; | |||||||||||||||||||||||||||