MPMinus/Helper/Util.pm

filter: Statementstmt 25.4% 32 / 126 Branchbran 5.7% 3 / 52 Conditioncond 2.5% 2 / 79 MC/DCmcdc 0.0% 0 / 48 Subroutinesub 62.5% 10 / 16 Podpod 100% 7 / 7 totaltotal 16.4% 54 / 328 SCAR 76.8
CC
58
Cov
14%
newconfig
992.0
getApache2
459.7
_void
6.0
CRAP 2168.2
« MPMinus/Configuration.pm ↑ Summary MPMinus/Util.pm »
1 package MPMinus::Helper::Util; # $Id: Util.pm 224 2017-04-04 10:27:41Z minus $
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3
4 =head1 NAME
5
6 MPMinus::Helper::Util - MPMinus Helper's utility
7
8 =head1 VERSION
9
10 Version 1.03
11
12 =head1 SYNOPSIS
13
14 use MPMinus::Helper::Util;
15
16 =head1 DESCRIPTION
17
18 MPMinus Helper's utility
19
20 =head1 FUNCTIONS
21
22 =over 8
23
24 =item B<cleanProjectName>
25
26 my $name = cleanProjectName( "foo" );
27
28 Returns clean name of project
29
30 =item B<cleanServerName>
31
32 my $name = cleanServerName( "localhost:80" );
33
34 Returns clean name of server
35
36 =item B<cleanServerNameF>
37
38 my $name = cleanServerNameF( "localhost" );
39
40 Returns clean name of server as file
41
42 =item B<getApache>, B<getApache2>
43
44 my $hash = getApache();
45
46 Returns HTTPD_ROOT, SERVER_CONFIG_FILE, SERVER_VERSION and APACHE_VERSION as hash structure
47 (reference).
48
49 =item B<newconfig>
50
51 my $config = newconfig( $c );
52
53 Returns new configuration
54
55 =item B<to_void>
56
57 my $v = to_void( $value );
58
59 Returns '' (void) if undefined $value else - returns $value
60
61 =back
62
63 =head1 AUTHOR
64
65 Sergey Lepenkov (Serz Minus) L<http://www.serzik.com> E<lt>minus@serzik.comE<gt>
66
67 =head1 COPYRIGHT
68
69 Copyright (C) 1998-2017 D&D Corporation. All Rights Reserved
70
71 =head1 LICENSE
72
73 This program is free software: you can redistribute it and/or modify
74 it under the terms of the GNU General Public License as published by
75 the Free Software Foundation, either version 3 of the License, or
76 (at your option) any later version.
77
78 This program is distributed in the hope that it will be useful,
79 but WITHOUT ANY WARRANTY; without even the implied warranty of
80 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
81 GNU General Public License for more details.
82
83 See C<LICENSE> file
84
85 =cut
86
87 1 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
88 1 $VERSION = 1.03;
89
90 1 ▶use base qw /Exporter/;
Subroutine BEGIN: called CC=1 SCAR=0.0
91 1 our @EXPORT = qw(
92 getApache getApache2
93 newconfig
94 to_void
95 cleanProjectName
96 cleanServerName
97 cleanServerNameF
98 );
99
100 1 ▶use CTK::Util qw/ :ALL /;
Subroutine BEGIN: called CC=1 SCAR=0.0
101 1 ▶use CTK::ConfGenUtil;
Subroutine BEGIN: called CC=1 SCAR=0.0
102 1 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
103
104 sub getApache2 {
105 # Ïðîöåäóðà ïîëó÷åíèÿ (HTTP_ROOT, SERVER_CONFIG_FILE, SERVER_VERSION, APACHE_VERSION) èñõîäÿ èç äàííûõ çàïóùåííîãî APACHE
106 1 ▶ my $httpdata;
Subroutine getApache2: called CC=27 SCAR=61.3
Pod documented
107 my $httpdpath;
108 1 ▶ if (isostype("Windows")) {
Branch: 1 branch
BranchTrueFalseTotal
if (isostype('Windows')) { } 0 1 1
109 0 $httpdpath = execute(q{pv.exe -e 2>NUL});
110 0 ▶ if ($httpdpath =~ /^httpd.exe\s+\d+\s+\S+\s+(.+?)\s*$/m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($httpdpath =~ /^httpd.exe\s+\d+\s+\S+\s+(.+?)\s*$/m) { } 0 0 0
111 0 $httpdpath = $1;
112 0 $httpdata = execute(qq{$httpdpath -V});
113 } else {
114 0 ▶ if ($httpdpath =~ /^(apache.+?)\s+\d+\s+\S+\s+(.+?)\1\s*$/im) {
Branch: 1 branch
BranchTrueFalseTotal
if ($httpdpath =~ /^(apache.+?)\s+\d+\s+\S+\s+(.+?)\1\s*$/im) { } 0 0 0
115 0 $httpdpath = catfile($2,'httpd.exe');
116 0 $httpdata = execute(qq{$httpdpath -V});
117 } else {
118 0 $httpdpath = '';
119 0 $httpdata = '';
120 }
121 }
122 } else {
123 # Fix #198
124 1 my @err;
125 1 foreach my $httpd (qw/httpd apache apachectl apache2ctl apache2 apache22/) {
126 6 my $cmd = qq{$httpd -V};
127 try {
128 6 ▶ $httpdata = execute($cmd)
Subroutine __ANON__: called CC=1 SCAR=0.0
129 } catch {
130 6 ▶ push @err, sprintf("%s: %s", $cmd, $_)
Subroutine __ANON__: called CC=1 SCAR=0.0
131 6 };
132 6 ▶ last if $httpdata && $httpdata =~ /HTTPD_ROOT/im;
Branch: 1 branch
BranchTrueFalseTotal
if $httpdata and $httpdata =~ /HTTPD_ROOT/im 0 6 6
Condition33%1/3
$httpdata and $httpdata =~ /HTTPD_ROOT/im
!ll&&!rl&&r
600
MC/DC0%0/2
$httpdata and $httpdata =~ /HTTPD_ROOT/im
$httpdata $httpdata =~ /HTTPD_ROOT/im
Truth table33%1/3
A and B
A= $httpdataB= $httpdata =~ /HTTPD_ROOT/im
ABresult
0X0
100
111
133 }
134 1 ▶ carp(join "\n", @err) if (!$httpdata) && @err
Branch: 1 branch
BranchTrueFalseTotal
if not $httpdata and @err 1 0 1
Condition33%1/3
not $httpdata and @err
!ll&&!rl&&r
001
MC/DC0%0/2
not $httpdata and @err
not $httpdata @err
Truth table33%1/3
not(A) and B
A= not $httpdataB= @err
ABresult
0X0
100
111
135 }
136
137 0 ▶ my $httpd_root = $httpdata =~ /HTTPD_ROOT\="(.+?)"/m ? $1 : '';
Branch: 1 branch
BranchTrueFalseTotal
$httpdata =~ /HTTPD_ROOT\="(.+?)"/m ? : 0 0 0
138 0 ▶ my $server_config_file = $httpdata =~ /SERVER_CONFIG_FILE\="(.+?)"/m ? $1 : '';
Branch: 1 branch
BranchTrueFalseTotal
$httpdata =~ /SERVER_CONFIG_FILE\="(.+?)"/m ? : 0 0 0
139 0 ▶ my $sver = $httpdata =~ /version\:\s+[a-z]+\/([0-9.]+)/im ? $1 : '';
Branch: 1 branch
BranchTrueFalseTotal
$httpdata =~ m[version\:\s+[a-z]+/([0-9.]+)]im ? : 0 0 0
140 0 my $aver = 0;
141
142 0 ▶ if ($sver =~ /([0-9]+)\.([0-9]+)\.([0-9]+)/) {
Branch: 3 branches
BranchTrueFalseTotal
if ($sver =~ /([0-9]+)\.([0-9]+)\.([0-9]+)/) { } 0 0 0
elsif ($sver =~ /([0-9]+)\.([0-9]+)/) { } 0 0 0
elsif ($sver =~ /([0-9]+)/) { } 0 0 0
143 0 $aver = $1 + ($2/100) + ($3/10000);
144 } elsif ($sver =~ /([0-9]+)\.([0-9]+)/) {
145 0 $aver = $1 + ($2/100);
146 } elsif ($sver =~ /([0-9]+)/) {
147 0 $aver = $1;
148 }
149
150 0 my $httpdconfig = '';
151 0 ▶ if ($server_config_file && $httpd_root) {
Branch: 1 branch
BranchTrueFalseTotal
if ($server_config_file and $httpd_root) 0 0 0
Condition0%0/3
$server_config_file and $httpd_root
!ll&&!rl&&r
000
MC/DC0%0/2
$server_config_file and $httpd_root
$server_config_file $httpd_root
Truth table0%0/3
A and B
A= $server_config_fileB= $httpd_root
ABresult
0X0
100
111
152 0 $httpdconfig = catfile($httpd_root,$server_config_file);
153 }
154
155 0 my $acc = '';
156 0 ▶ unless ($httpdconfig && -e $httpdconfig) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($httpdconfig and -e $httpdconfig) 0 0 0
Condition0%0/3
$httpdconfig and -e $httpdconfig
!ll&&!rl&&r
000
MC/DC0%0/2
$httpdconfig and -e $httpdconfig
$httpdconfig -e $httpdconfig
Truth table0%0/3
A and B
A= $httpdconfigB= -e $httpdconfig
ABresult
0X0
100
111
157 0 foreach (split /[\/\\]/, $httpdpath) {
158 0 ▶ $acc = $acc ? catfile($acc,$_) : $_;
Branch: 1 branch
BranchTrueFalseTotal
$acc ? : 0 0 0
159
160 0 $httpdconfig = catfile($acc,$server_config_file);
161 0 ▶ if ($httpdconfig && (-e $httpdconfig) && ((-f $httpdconfig) || (-l $httpdconfig))) {
Branch: 1 branch
BranchTrueFalseTotal
if ($httpdconfig and -e $httpdconfig and -f $httpdconfig || -l $httpdconfig) 0 0 0
Condition0%0/9
$httpdconfig and -e $httpdconfig and -f $httpdconfig || -l $httpdconfig
!ll&&!rl&&r
000
$httpdconfig and -e $httpdconfig
!ll&&!rl&&r
000
-f $httpdconfig or -l $httpdconfig
l!l&&r!l&&!r
000
MC/DC0%0/4
$httpdconfig and -e $httpdconfig and -f $httpdconfig || -l $httpdconfig
$httpdconfig -e $httpdconfig -f $httpdconfig -l $httpdconfig
Truth table0%0/5
A and B and C or D
A= $httpdconfigB= -e $httpdconfigC= -f $httpdconfigD= -l $httpdconfig
ABCDresult
0XXX0
10XX0
11000
111X1
11011
162 0 last;
163 }
164 }
165 }
166
167 return {
168 0 ▶ HTTPD_ROOT => $acc || $httpd_root,
Condition0%0/5
$acc || $httpd_root
l!l&&r!l&&!r
000
$httpdconfig || ''
l!l
00
MC/DC0%0/2
$acc || $httpd_root
$acc $httpd_root
MC/DC0%0/1
$httpdconfig || ''
$httpdconfig
Truth table0%0/3
A || B
A= $accB= $httpd_root
ABresult
1X1
011
000
Truth table0%0/2
A
A= $httpdconfig
Aresult
11
00
169 SERVER_CONFIG_FILE => $httpdconfig || '',
170 SERVER_VERSION => $sver,
171 APACHE_VERSION => $aver,
172 };
173
174 }
175 1 ▶sub getApache { goto &getApache2 }
Subroutine getApache: called CC=1 SCAR=0.0
Pod documented
176 sub newconfig {
177 # Çàïðîñ äàííûõ êîíôèãóðàöèè
178 0 ▶ my $c = shift;
Subroutine newconfig: not called CC=31 SCAR=69.0
Pod documented
179 0 my $cfg = $c->config();
180
181 0 my %newcfg = (
182 Include => 'conf/*.conf',
183 );
184
185 0 my ($k,$v,$d) = ('','','');
186 0 my $apache = getApache();
187
188 # Apache HTTPD_ROOT
189 0 $k = "HttpdRoot";
190 0 ▶ $newcfg{$k} = $c->cli_prompt('Apache HTTPD_ROOT:', _void(value($cfg,lc($k)) || $apache->{HTTPD_ROOT}));
Condition0%0/3
value($cfg, lc $k) || $apache->{'HTTPD_ROOT'}
l!l&&r!l&&!r
000
MC/DC0%0/2
value($cfg, lc $k) || $apache->{'HTTPD_ROOT'}
value($cfg, lc $k) $apache->{'HTTPD_ROOT'}
Truth table0%0/3
A || B
A= value($cfg, lc $k)B= $apache->{'HTTPD_ROOT'}
ABresult
1X1
011
000
191
192 # Apache SERVER_CONFIG_FILE
193 0 $k = "ServerConfigFile";
194 0 ▶ $newcfg{$k} = $c->cli_prompt('Apache SERVER_CONFIG_FILE:', _void(value($cfg,lc($k)) || $apache->{SERVER_CONFIG_FILE}));
Condition0%0/3
value($cfg, lc $k) || $apache->{'SERVER_CONFIG_FILE'}
l!l&&r!l&&!r
000
MC/DC0%0/2
value($cfg, lc $k) || $apache->{'SERVER_CONFIG_FILE'}
value($cfg, lc $k) $apache->{'SERVER_CONFIG_FILE'}
Truth table0%0/3
A || B
A= value($cfg, lc $k)B= $apache->{'SERVER_CONFIG_FILE'}
ABresult
1X1
011
000
195
196 # Apache configuration
197 0 my %apacheconfig;
198 0 ▶ if ((-e $newcfg{ServerConfigFile}) && -e $newcfg{HttpdRoot}) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $newcfg{"ServerConfigFile"} and -e $newcfg{"HttpdRoot"}) 0 0 0
Condition0%0/3
-e $newcfg{"ServerConfigFile"} and -e $newcfg{"HttpdRoot"}
!ll&&!rl&&r
000
MC/DC0%0/2
-e $newcfg{"ServerConfigFile"} and -e $newcfg{"HttpdRoot"}
-e $newcfg{"ServerConfigFile"} -e $newcfg{"HttpdRoot"}
Truth table0%0/3
A and B
A= -e $newcfg{"ServerConfigFile"}B= -e $newcfg{"HttpdRoot"}
ABresult
0X0
100
111
199 my $apacheconf = new Config::General(
200 -ConfigFile => $newcfg{ServerConfigFile},
201 0 -ConfigPath => [$newcfg{HttpdRoot}],
202 -ApacheCompatible => 1,
203 -LowerCaseNames => 1,
204 );
205 0 %apacheconfig = $apacheconf->getall;
206 }
207
208 # ModperlRoot
209 0 $k = "ModperlRoot";
210 0 my @mpvs = ('none', _void(webdir()), 'custom'
211 );
212 0 ▶ my $vks = value($apacheconfig{documentroot} || '');
Condition0%0/2
$apacheconfig{'documentroot'} || ''
l!l
00
MC/DC0%0/1
$apacheconfig{'documentroot'} || ''
$apacheconfig{'documentroot'}
Truth table0%0/2
A
A= $apacheconfig{'documentroot'}
Aresult
11
00
213 0 ▶ unshift(@mpvs,$vks) if $vks;
Branch: 1 branch
BranchTrueFalseTotal
if $vks 0 0 0
214 0 $v = $c->cli_select('ModperlRoot directory:',\@mpvs,1);
215 0 ▶ $v = $c->cli_prompt('ModperlRoot directory:',_void(value($cfg,lc($k))),) if ($v && $v eq 'custom');
Branch: 1 branch
BranchTrueFalseTotal
if $v and $v eq "custom" 0 0 0
Condition0%0/3
$v and $v eq "custom"
!ll&&!rl&&r
000
MC/DC0%0/2
$v and $v eq "custom"
$v $v eq "custom"
Truth table0%0/3
A and B
A= $vB= $v eq "custom"
ABresult
0X0
100
111
216 0 ▶ $newcfg{$k} = ($v && $v eq 'none') ? undef : $v;
Branch: 1 branch
BranchTrueFalseTotal
$v && $v eq 'none' ? : 0 0 0
Condition0%0/3
$v and $v eq "none"
!ll&&!rl&&r
000
MC/DC0%0/2
$v and $v eq "none"
$v $v eq "none"
Truth table0%0/3
A and B
A= $vB= $v eq "none"
ABresult
0X0
100
111
217
218 # NameVirtualHost
219 0 $k = "NameVirtualHost";
220 0 ▶ my $namevirtualhost = array($apacheconfig{namevirtualhost} || ['*:80']);
Condition0%0/2
$apacheconfig{'namevirtualhost'} || ['*:80']
l!l
00
MC/DC0%0/1
$apacheconfig{'namevirtualhost'} || ['*:80']
$apacheconfig{'namevirtualhost'}
Truth table0%0/2
A
A= $apacheconfig{'namevirtualhost'}
Aresult
11
00
221 0 push @$namevirtualhost, 'custom','none';
222 0 $v = $c->cli_select('NameVirtualHost:', $namevirtualhost, 1);
223 0 ▶ $v = $c->cli_prompt('NameVirtualHost:',_void(value($cfg,lc($k))),) if ($v && $v eq 'custom');
Branch: 1 branch
BranchTrueFalseTotal
if $v and $v eq "custom" 0 0 0
Condition0%0/3
$v and $v eq "custom"
!ll&&!rl&&r
000
MC/DC0%0/2
$v and $v eq "custom"
$v $v eq "custom"
Truth table0%0/3
A and B
A= $vB= $v eq "custom"
ABresult
0X0
100
111
224 0 ▶ $newcfg{$k} = ($v && $v eq 'none') ? undef : $v;
Branch: 1 branch
BranchTrueFalseTotal
$v && $v eq 'none' ? : 0 0 0
Condition0%0/3
$v and $v eq "none"
!ll&&!rl&&r
000
MC/DC0%0/2
$v and $v eq "none"
$v $v eq "none"
Truth table0%0/3
A and B
A= $vB= $v eq "none"
ABresult
0X0
100
111
225
226 # ServerName
227 0 $k = "ServerName";
228 0 ▶ my $servername = array($apacheconfig{servername} || ['localhost']);
Condition0%0/2
$apacheconfig{'servername'} || ['localhost']
l!l
00
MC/DC0%0/1
$apacheconfig{'servername'} || ['localhost']
$apacheconfig{'servername'}
Truth table0%0/2
A
A= $apacheconfig{'servername'}
Aresult
11
00
229 0 push @$servername, 'custom','none';
230 0 $v = $c->cli_select('ServerName (host):', $servername, 1);
231 0 ▶ $v = $c->cli_prompt('ServerName (host):',_void(value($cfg,lc($k))),) if ($v && $v eq 'custom');
Branch: 1 branch
BranchTrueFalseTotal
if $v and $v eq "custom" 0 0 0
Condition0%0/3
$v and $v eq "custom"
!ll&&!rl&&r
000
MC/DC0%0/2
$v and $v eq "custom"
$v $v eq "custom"
Truth table0%0/3
A and B
A= $vB= $v eq "custom"
ABresult
0X0
100
111
232 0 ▶ $newcfg{$k} = ($v && $v eq 'none') ? undef : $v;
Branch: 1 branch
BranchTrueFalseTotal
$v && $v eq 'none' ? : 0 0 0
Condition0%0/3
$v and $v eq "none"
!ll&&!rl&&r
000
MC/DC0%0/2
$v and $v eq "none"
$v $v eq "none"
Truth table0%0/3
A and B
A= $vB= $v eq "none"
ABresult
0X0
100
111
233
234 # ErrorMail
235 0 $k = "ErrorMail";
236 0 ▶ my $errormail = array($apacheconfig{serveradmin} || ['root@localhost']);
Condition0%0/2
$apacheconfig{'serveradmin'} || ['root@localhost']
l!l
00
MC/DC0%0/1
$apacheconfig{'serveradmin'} || ['root@localhost']
$apacheconfig{'serveradmin'}
Truth table0%0/2
A
A= $apacheconfig{'serveradmin'}
Aresult
11
00
237 0 push @$errormail, 'custom','none';
238 0 $v = $c->cli_select('ErrorMail (ServerAdmin):', $errormail, 1);
239 0 ▶ $v = $c->cli_prompt('ErrorMail: (ServerAdmin):',_void(value($cfg,lc($k))),) if ($v && $v eq 'custom');
Branch: 1 branch
BranchTrueFalseTotal
if $v and $v eq "custom" 0 0 0
Condition0%0/3
$v and $v eq "custom"
!ll&&!rl&&r
000
MC/DC0%0/2
$v and $v eq "custom"
$v $v eq "custom"
Truth table0%0/3
A and B
A= $vB= $v eq "custom"
ABresult
0X0
100
111
240 0 ▶ $newcfg{$k} = ($v && $v eq 'none') ? undef : $v;
Branch: 1 branch
BranchTrueFalseTotal
$v && $v eq 'none' ? : 0 0 0
Condition0%0/3
$v and $v eq "none"
!ll&&!rl&&r
000
MC/DC0%0/2
$v and $v eq "none"
$v $v eq "none"
Truth table0%0/3
A and B
A= $vB= $v eq "none"
ABresult
0X0
100
111
241
242 # SMTP
243 0 $k = "SMTP";
244 0 $newcfg{$k} = $c->cli_prompt('SMTP server:', _void(value($cfg,lc($k))));
245
246 # MailTo
247 0 $k = "MailTo";
248 0 ▶ $newcfg{$k} = $c->cli_prompt('Address MailTO:', _void(value($cfg,lc($k)) || $newcfg{ErrorMail}));
Condition0%0/3
value($cfg, lc $k) || $newcfg{'ErrorMail'}
l!l&&r!l&&!r
000
MC/DC0%0/2
value($cfg, lc $k) || $newcfg{'ErrorMail'}
value($cfg, lc $k) $newcfg{'ErrorMail'}
Truth table0%0/3
A || B
A= value($cfg, lc $k)B= $newcfg{'ErrorMail'}
ABresult
1X1
011
000
249
250 # MailCC
251 0 $k = "MailCC";
252 0 $newcfg{$k} = $c->cli_prompt('Address MailCC:', _void(value($cfg,lc($k))));
253
254 # MailFrom
255 0 $k = "MailFrom";
256 0 ▶ $newcfg{$k} = $c->cli_prompt('Address MailFrom:', _void(value($cfg,lc($k)) || $newcfg{ErrorMail}));
Condition0%0/3
value($cfg, lc $k) || $newcfg{'ErrorMail'}
l!l&&r!l&&!r
000
MC/DC0%0/2
value($cfg, lc $k) || $newcfg{'ErrorMail'}
value($cfg, lc $k) $newcfg{'ErrorMail'}
Truth table0%0/3
A || B
A= value($cfg, lc $k)B= $newcfg{'ErrorMail'}
ABresult
1X1
011
000
257
258 # MailCharset
259 0 $k = "MailCharset";
260 0 ▶ $newcfg{$k} = $c->cli_prompt('Mail Charset for translating into UTF8:', _void(value($cfg,lc($k)) || 'Windows-1251'));
Condition0%0/2
value($cfg, lc $k) || 'Windows-1251'
l!l
00
MC/DC0%0/1
value($cfg, lc $k) || 'Windows-1251'
value($cfg, lc $k)
Truth table0%0/2
A
A= value($cfg, lc $k)
Aresult
11
00
261
262 # MailCmd
263 0 $k = "MailCmd";
264 0 ▶ $newcfg{$k} = $c->cli_prompt('Mail program (sendmail):', _void(value($cfg,lc($k)) || '/usr/sbin/sendmail'));
Condition0%0/2
value($cfg, lc $k) || '/usr/sbin/sendmail'
l!l
00
MC/DC0%0/1
value($cfg, lc $k) || '/usr/sbin/sendmail'
value($cfg, lc $k)
Truth table0%0/2
A
A= value($cfg, lc $k)
Aresult
11
00
265
266 # MailFlag
267 0 $k = "MailFlag";
268 0 ▶ $newcfg{$k} = $c->cli_prompt('Mail program\'s flag:', _void(value($cfg,lc($k)) || '-t'));
Condition0%0/2
value($cfg, lc $k) || '-t'
l!l
00
MC/DC0%0/1
value($cfg, lc $k) || '-t'
value($cfg, lc $k)
Truth table0%0/2
A
A= value($cfg, lc $k)
Aresult
11
00
269
270 0 return { %newcfg };
271 }
272 0 ▶sub to_void { goto &_void }
Subroutine to_void: not called CC=1 SCAR=6.9
Pod documented
273 sub cleanProjectName {
274 # Ïðàâêà (÷èñòêà) èìåíè ïðîåêòà
275 0 ▶ my $pn = _void(shift);
Subroutine cleanProjectName: not called CC=1 SCAR=6.9
Pod documented
276 0 $pn =~ s/[^a-z0-9_]/X/ig;
277 0 return $pn;
278 }
279 sub cleanServerName {
280 # Ïðàâêà (÷èñòêà) èìåíè ñåðâåðà (ñàéòà)
281 0 ▶ my $sn = _void(shift);
Subroutine cleanServerName: not called CC=1 SCAR=6.9
Pod documented
282 0 $sn =~ s/[^a-z0-9_\-.:]/X/ig;
283 0 return $sn;
284 }
285 sub cleanServerNameF {
286 # Ïðàâêà (÷èñòêà) èìåíè ñåðâåðà (ñàéòà) â ñòàíäàðòå èìåí ôàéëîâ
287 0 ▶ my $sn = _void(shift);
Subroutine cleanServerNameF: not called CC=1 SCAR=6.9
Pod documented
288 0 $sn =~ s/[^a-z0-9_\-.]//ig;
289 0 return $sn;
290 }
291
292 sub _void {
293 # Âîçâðàùàåò '' (void) ìåñòî undef
294 0 ▶ my $v = shift;
Subroutine _void: not called CC=2 SCAR=17.9
295 0 ▶ return '' unless defined $v;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $v 0 0 0
296 0 return $v;
297 }
298 1 1;
299
300 __END__
« MPMinus/Configuration.pm ↑ Summary MPMinus/Util.pm »