line |
true |
false |
branch |
36
|
3 |
68 |
@_ == 1 ? : |
45
|
8 |
62 |
ref $_[0] ? : |
46
|
3 |
67 |
@_ == 1 ? : |
72
|
13 |
0 |
if ($ok) { } |
89
|
70 |
3 |
unless eval {
do {
local $SIG{'__DIE__'};
$self->commandline
}
} |
93
|
0 |
73 |
unless $self->default_values |
94
|
20 |
53 |
if @defaults |
99
|
70 |
0 |
ref $_[0] ? : |
|
70 |
73 |
if @_ |
106
|
70 |
0 |
if $script =~ m[^[^/]+/] and $ENV{'PWD'} |
116
|
27 |
73 |
$_[0] && ref $_[0] ? : |
118
|
4 |
96 |
if @ARGV |
119
|
100 |
0 |
if $prop->{'_run_args'} |
121
|
8 |
92 |
if ($prop->{'conf_file'}) { } |
125
|
1 |
91 |
if $def->{'conf_file'} |
135
|
70 |
0 |
unless defined $prop->{'log_level'} and $prop->{'log_level'} =~ /^\d+$/ |
136
|
0 |
70 |
if $prop->{'log_level'} > 4 |
139
|
0 |
70 |
if ($prop->{'pid_file'}) |
140
|
0 |
0 |
unless (eval {
do {
&check_pid_file($prop->{'pid_file'})
}
}) |
141
|
0 |
0 |
unless $ENV{'BOUND_SOCKETS'} |
146
|
69 |
1 |
unless ($prop->{'_is_inet'}) |
147
|
0 |
69 |
if ($prop->{'setsid'} or length $prop->{'log_file'}) |
148
|
0 |
0 |
unless open STDIN, "<", "/dev/null" |
149
|
0 |
0 |
unless open STDOUT, ">", "/dev/null" |
153
|
70 |
0 |
unless ($ENV{'BOUND_SOCKETS'}) |
154
|
0 |
70 |
if ($prop->{'setsid'} or $prop->{'background'}) |
156
|
0 |
0 |
unless defined $pid |
157
|
0 |
0 |
if $pid |
161
|
0 |
70 |
if $prop->{'setsid'} |
164
|
0 |
70 |
if (length $prop->{'log_file'} and not $prop->{'log_function'}) { } |
|
0 |
70 |
elsif ($prop->{'setsid'}) { } |
173
|
0 |
70 |
if ($prop->{'pid_file'}) |
174
|
0 |
0 |
if (eval {
do {
&create_pid_file($prop->{'pid_file'})
}
}) { } |
184
|
0 |
70 |
if $prop->{'double_reverse_lookups'} |
186
|
0 |
70 |
if $prop->{'reverse_lookups'} and $prop->{'reverse_lookups'} =~ /^(?:double|2)(.*)$/i |
192
|
70 |
0 |
unless (defined $prop->{'log_file'}) |
198
|
0 |
0 |
if (my $code = $prop->{'log_function'}) { } |
|
0 |
0 |
elsif ($prop->{'log_file'} =~ /^([a-zA-Z]\w*(?:::[a-zA-Z]\w*)*)$/) { } |
199
|
0 |
0 |
if (ref $code ne "CODE") |
201
|
0 |
0 |
unless $self->can($code) |
209
|
0 |
0 |
if (eval {
do {
require $file
}
}) { } |
|
0 |
0 |
elsif ($file =~ /::/ or grep {-e "$_/$file";} @INC) { } |
219
|
0 |
0 |
unless $prop->{'log_file'} =~ m(^([\:\w\.\-/\\]+)$) |
221
|
0 |
0 |
unless open _SERVER_LOG, ">>", $prop->{'log_file'} |
237
|
3 |
66 |
if ($self->isa("Net::Server::MultiType")) |
241
|
69 |
0 |
if $type ne $super |
245
|
0 |
69 |
if not @{$prop->{'sock'};} |
254
|
7 |
62 |
if (not defined $ports or ref $ports and not @$ports) |
256
|
0 |
7 |
if (not defined $ports or ref $ports and not @$ports) |
264
|
62 |
7 |
ref $ports ? : |
265
|
82 |
18 |
@$bind >= @$hosts ? : |
|
100 |
0 |
ref $hosts ? : |
266
|
90 |
10 |
@$bind >= @$protos ? : |
|
100 |
0 |
ref $protos ? : |
267
|
87 |
13 |
@$bind >= @$ipvs ? : |
|
100 |
0 |
ref $ipvs ? : |
270
|
0 |
100 |
if ($port ne 0 and $bound{"$host\e$port\e$proto\e$ipv"}++) |
295
|
0 |
12 |
if (exists $ENV{'BOUND_SOCKETS'}) { } |
301
|
0 |
0 |
unless defined $orig |
302
|
0 |
0 |
$fd =~ /^(\d+)$/ ? : |
307
|
0 |
0 |
if (my $ref = $map{$sock->hup_string}) { } |
311
|
0 |
0 |
unless keys %$ref |
333
|
7 |
5 |
if (@{$prop->{'sock'};} > 1 or $prop->{'multi_port'}) { } |
350
|
13 |
0 |
if (not defined $prop->{'group'}) { } |
|
0 |
0 |
elsif ($prop->{'group'} =~ /^([\w.-]+(?:[ ,][\w.-]+)*)$/) { } |
355
|
0 |
0 |
if $@ |
360
|
13 |
0 |
if (not defined $prop->{'user'}) { } |
|
0 |
0 |
elsif ($prop->{'user'} =~ /^([\w.-]+)$/) { } |
365
|
0 |
0 |
if $@ |
371
|
0 |
13 |
if ($prop->{'group'} ne $) or $prop->{'user'} ne $>) |
374
|
0 |
0 |
if $prop->{'pid_file_unlink'} |
375
|
0 |
0 |
if $prop->{'lock_file_unlink'} |
376
|
0 |
0 |
unless $prop->{'chown_files'} |
380
|
0 |
0 |
unless chown $uid, $gid, $file |
384
|
0 |
13 |
if ($prop->{'chroot'}) |
385
|
0 |
0 |
unless -d $prop->{'chroot'} |
387
|
0 |
0 |
unless chroot $prop->{'chroot'} |
392
|
0 |
13 |
if ($prop->{'group'} ne $)) |
396
|
0 |
13 |
if ($prop->{'user'} ne $>) |
401
|
0 |
13 |
if ($@) |
402
|
0 |
0 |
if ($> == 0) { } |
|
0 |
0 |
elsif ($< == 0) { } |
430
|
2 |
3 |
if $self->done |
441
|
8 |
5 |
if ($prop->{'multi_port'}) { } |
442
|
0 |
8 |
if $prop->{'_HUP'} |
444
|
0 |
7 |
if $prop->{'_HUP'} |
445
|
0 |
7 |
if ($self->can_read_hook($sock)) |
452
|
0 |
12 |
unless defined $sock |
454
|
1 |
11 |
if (2 == $sock->getsockopt(1, 3)) { } |
464
|
0 |
12 |
if $prop->{'_HUP'} |
465
|
12 |
0 |
if $prop->{'client'} |
478
|
0 |
7 |
unless @waiting |
490
|
1 |
11 |
if $prop->{'udp_true'} |
492
|
0 |
11 |
unless ($client) |
497
|
3 |
8 |
if $client->can("post_accept") |
498
|
10 |
1 |
if (not $prop->{'no_client_stdout'}) |
501
|
4 |
6 |
if ($prop->{'tie_client_stdout'} or $client->can('tie_stdout') and $client->tie_stdout) { } |
|
6 |
0 |
elsif (defined(my $fileno = fileno $prop->{'client'})) { } |
502
|
0 |
4 |
unless open STDIN, "<", "/dev/null" |
503
|
0 |
4 |
unless open STDOUT, ">", "/dev/null" |
504
|
0 |
4 |
unless tie *STDOUT, "Net::Server::TiedHandle", $client, $prop->{'tied_stdout_callback'} |
505
|
0 |
4 |
unless tie *STDIN, "Net::Server::TiedHandle", $client, $prop->{'tied_stdin_callback'} |
507
|
0 |
6 |
unless open STDIN, "<&", $fileno |
508
|
0 |
6 |
unless open STDOUT, ">&", $fileno |
524
|
0 |
12 |
if ($client->NS_proto =~ /^UNIX/) |
526
|
0 |
0 |
if $prop->{'log_level'} and 3 <= $prop->{'log_level'} |
530
|
12 |
0 |
if (my $sockname = $client->sockname) { } |
538
|
1 |
11 |
if ($prop->{'udp_true'}) { } |
|
11 |
0 |
elsif ($prop->{'peername'} = $client->peername) { } |
539
|
1 |
0 |
if ($client->sockdomain == 2) { } |
544
|
0 |
0 |
'Socket6'->can('inet_ntop') ? : |
557
|
0 |
12 |
if ($addr and $prop->{'reverse_lookups'}) |
558
|
0 |
0 |
if ($client->can('peerhostname')) { } |
|
0 |
0 |
elsif ($INC{'Socket6.pm'} and 'Socket6'->can('getnameinfo')) { } |
562
|
0 |
0 |
if @res > 1 |
566
|
0 |
0 |
if ($prop->{'peerhost'} and $prop->{'double_reverse_lookups'}) |
574
|
0 |
0 |
$prop->{'peerhost'} ? : |
|
0 |
12 |
if $prop->{'log_level'} and 3 <= $prop->{'log_level'} |
585
|
0 |
13 |
if $sock and $sock->NS_proto =~ /^UNIX/ |
589
|
0 |
13 |
$prop->{'peeraddr'} =~ /^\s*::ffff:(\d+(?:\.\d+){3})$/ ? : |
591
|
0 |
13 |
if ($prop->{'double_reverse_lookups'}) |
592
|
0 |
0 |
unless $self->double_reverse_lookup($peeraddr, $prop->{'peerhost'}, $prop->{'peerhost_rev'}, $prop->{'peeraddr'}) |
599
|
13 |
0 |
unless @{$prop->{'allow'};} or @{$prop->{'deny'};} or @{$prop->{'cidr_allow'};} or @{$prop->{'cidr_deny'};} |
604
|
0 |
0 |
if $prop->{'reverse_lookups'} and defined $prop->{'peerhost'} and $prop->{'peerhost'} =~ /^$_$/ |
605
|
0 |
0 |
if $peeraddr =~ /^$_$/ |
607
|
0 |
0 |
if (@{$prop->{'cidr_deny'};}) |
609
|
0 |
0 |
if Net::CIDR::cidrlookup($peeraddr, @{$$prop{"cidr_deny"};}) |
615
|
0 |
0 |
if $prop->{'reverse_lookups'} and defined $prop->{'peerhost'} and $prop->{'peerhost'} =~ /^$_$/ |
616
|
0 |
0 |
if $peeraddr =~ /^$_$/ |
618
|
0 |
0 |
if (@{$prop->{'cidr_allow'};}) |
620
|
0 |
0 |
if Net::CIDR::cidrlookup($peeraddr, @{$$prop{"cidr_allow"};}) |
629
|
0 |
0 |
if (not $host) { } |
|
0 |
0 |
elsif (not $rev_addrs) { } |
636
|
0 |
0 |
$orig_addr && $orig_addr ne $addr ? : |
637
|
0 |
0 |
if (not $rev_addrs->{$addr} || $rev_addrs->{$orig_addr}) { } |
|
0 |
0 |
elsif ($cfg =~ /autofail/i) { } |
|
0 |
0 |
elsif ($cfg =~ /debug/) { } |
638
|
0 |
0 |
$cfg =~ /detail/i ? : |
658
|
1 |
9 |
if ($prop->{'udp_true'}) |
660
|
0 |
1 |
if ($prop->{'udp_data'} =~ /dump/) |
675
|
0 |
9 |
if (/get\s+(\w+)/) { } |
|
0 |
9 |
elsif (/dump/) { } |
|
3 |
6 |
elsif (/quit/) { } |
|
6 |
0 |
elsif (/exit/) { } |
684
|
0 |
3 |
if $@ eq "Timed Out!\n" |
699
|
1 |
5 |
if $prop->{'udp_true'} |
701
|
4 |
1 |
unless ($prop->{'no_client_stdout'}) |
702
|
2 |
2 |
if ($t) |
703
|
2 |
2 |
if ($t) |
704
|
0 |
4 |
unless open STDIN, "<", "/dev/null" |
705
|
0 |
4 |
unless open STDOUT, ">", "/dev/null" |
712
|
0 |
3 |
if @_ |
725
|
0 |
0 |
unless defined $pid |
726
|
0 |
0 |
unless ($pid) |
740
|
0 |
0 |
if $self->{'server'}{'children'} |
761
|
0 |
3 |
if (defined $prop->{'ppid'} and $prop->{'ppid'} != $$ and not defined $prop->{'no_close_by_child'}) |
772
|
0 |
0 |
if ($prop->{'kind_quit'} and $prop->{'children'}) |
778
|
0 |
0 |
if $self->can("coordinate_children") |
779
|
0 |
0 |
unless keys %{$$self{"server"}{"children"};} |
784
|
0 |
12 |
if ($prop->{'_HUP'} and $prop->{'leave_children_open_on_hup'}) { } |
788
|
3 |
9 |
if $prop->{'children'} |
792
|
2 |
0 |
if (defined $prop->{'lock_file'} and -e $prop->{'lock_file'} and defined $prop->{'lock_file_unlink'}) |
795
|
0 |
2 |
unless unlink $prop->{'lock_file'} |
797
|
0 |
0 |
if (defined $prop->{'pid_file'} and -e $prop->{'pid_file'} and not $prop->{'_HUP'} and defined $prop->{'pid_file_unlink'}) |
801
|
0 |
0 |
unless unlink $prop->{'pid_file'} |
803
|
0 |
12 |
if (defined $prop->{'sem'}) |
807
|
0 |
12 |
if ($prop->{'_HUP'}) |
813
|
0 |
12 |
if $prop->{'no_exit_on_close'} |
828
|
0 |
16 |
if $sock->NS_proto =~ /^UNIX/ |
840
|
0 |
0 |
unless $prop->{'ppid'} |
849
|
0 |
3 |
unless $prop->{'children'} and scalar keys %{$$prop{"children"};} |
853
|
4 |
0 |
if (kill "TERM", $pid or not kill(0, $pid)) |
867
|
0 |
0 |
unless defined $prop->{'children'} and scalar keys %{$$prop{"children"};} |
868
|
0 |
0 |
unless $self->is_prefork |
873
|
0 |
0 |
unless kill "HUP", $pid |
897
|
0 |
0 |
unless $prop->{'_HUP'}[$i]->fdopen($fd, "w") |
911
|
0 |
0 |
if ($prop->{'leave_children_open_on_hup'} and scalar keys %{$$prop{"children"};}) |
947
|
0 |
93 |
unless $prop->{'log_level'} |
948
|
25 |
68 |
if $level =~ /^\d+$/ and $level > $prop->{'log_level'} |
949
|
0 |
68 |
if @therest |
951
|
5 |
63 |
if ($prop->{'log_function'}) |
952
|
5 |
0 |
if eval {
do {
$prop->{'log_function'}->($level, $msg);
1
}
} |
954
|
0 |
0 |
if ($prop->{'log_class'} and $prop->{'log_class'}->can('handle_error')) { } |
961
|
0 |
63 |
unless $level =~ /^\d+$/ |
975
|
0 |
63 |
if ($prop->{'log_file'}) { } |
|
0 |
63 |
elsif ($prop->{'setsid'}) { } |
1000
|
552 |
296 |
if (not defined $prop->{$_}) { } |
|
8 |
288 |
elsif (not ref $prop->{$_}) { } |
1026
|
106 |
27 |
unless $template and ref $template |
1027
|
0 |
0 |
unless ($_[2] or scalar keys %$template or $self->{'server'}{'_no_options'}++) |
1034
|
318 |
13 |
if ($args->[$i] =~ /^(?:--)?(\w+)(?:[=\ ](\S+))?$/ and exists $template->{$1}) |
1038
|
315 |
3 |
unless (defined $val) |
1039
|
0 |
315 |
if ($i > $#$args or $args->[$i] and $args->[$i] =~ /^--\w+/) { } |
1044
|
0 |
35 |
if ref $val eq "ARRAY" and @$val == 1 and ref $template->{$key} ne "ARRAY" |
1048
|
274 |
44 |
unless ref $val |
1050
|
184 |
134 |
if (ref $template->{$key} eq 'ARRAY') { } |
1051
|
142 |
42 |
unless (defined $previously_set{$key}) |
1054
|
12 |
172 |
if $previously_set{$key} |
1055
|
35 |
137 |
ref $val eq 'ARRAY' ? : |
1057
|
116 |
18 |
unless (defined $previously_set{$key}) |
1058
|
24 |
92 |
defined ${$$template{$key};} ? : |
1060
|
27 |
107 |
if $previously_set{$key} |
1061
|
0 |
107 |
if ref $val eq "ARRAY" |
1071
|
9 |
0 |
$file =~ m[^([\w\.\-\/\\\:]+)$] ? : |
1072
|
0 |
9 |
unless (open my $fh, "<", $file) |
1073
|
0 |
0 |
if $ENV{'BOUND_SOCKETS'} |
1077
|
54 |
135 |
if $line =~ /(.*?)(?
|
1079
|
99 |
90 |
if $line =~ /^\s*((?:--)?\w+)(?:\s*[=:]\s*|\s+)(.+)/ |
1095
|
0 |
4 |
unless exists $prop->{'children'}{$pid} |
1098
|
1 |
3 |
if ($prop->{'child_communication'}) |
1099
|
1 |
0 |
if ($prop->{'children'}{$pid}{'sock'}) |
1115
|
0 |
0 |
unless kill $sig, $chld |
1123
|
0 |
3 |
unless ref $ref |
1124
|
0 |
3 |
if ref $ref ne "ARRAY" |
1125
|
3 |
0 |
unless @$ref |
1130
|
0 |
0 |
if ($code) { } |
1133
|
0 |
0 |
ref $SIG{$sig} eq 'CODE' ? : |
1135
|
0 |
0 |
if $code |
1144
|
0 |
2 |
$s->[1] ? : |
1145
|
0 |
0 |
$s->[1] ? : |
1146
|
3 |
4 |
$s->[1] ? : |
1147
|
0 |
0 |
$s->[1] ? : |
1148
|
0 |
0 |
$s->[1] ? : |
1149
|
0 |
0 |
$s->[1] ? : |
1150
|
0 |
0 |
$s->[1] ? : |
1151
|
0 |
0 |
$s->[1] ? : |
1152
|
0 |
0 |
$s->[1] ? : |
1155
|
0 |
0 |
$s->[1] ? : |