Branch Coverage

lib/HTTP/Handy.pm
Criterion Covered Total %
branch 47 146 32.1


line true false branch
21 0 6 if ($] < "5.006" and not defined &warnings::import)
23 0 6 if $INC[-1] eq "."
89 0 0 unless my $app = $args{'app'}
90 0 0 defined $args{'host'} ? :
91 0 0 defined $args{'port'} ? :
92 0 0 defined $args{'log'} ? :
93 0 0 defined $args{'max_post_size'} ? :
95 0 0 unless ref $app eq "CODE"
96 0 0 unless $port =~ /^\d+$/
97 0 0 unless $max_post_size =~ /^\d+$/
106 0 0 unless ($server)
113 0 0 if $log
114 0 0 if $log
118 0 0 unless ($client)
119 0 0 if $log
129 0 0 if ($@)
130 0 0 if $log
145 0 0 unless defined $request_line and $request_line ne ""
152 0 0 unless (defined $method and $method eq 'GET' || $method eq 'POST')
159 0 0 if (defined $request_uri)
160 0 0 if ($request_uri =~ /^([^?]*)\?(.*)$/) { }
168 0 0 unless defined $path and $path ne ""
174 0 0 unless defined $line
176 0 0 if $line eq ""
178 0 0 if ($line =~ /^([^:]+):\s*(.*)$/)
192 0 0 $headers{'host'} && $headers{'host'} =~ /:(\d+)$/ ? :
199 0 0 if ($content_length > $max_post_size)
206 0 0 if ($method eq "POST" and $content_length > 0)
239 0 0 if ($@)
247 0 0 unless (ref $response eq "ARRAY" and scalar @$response == 3)
261 0 0 if (ref $resp_headers eq "ARRAY")
269 0 0 if @header_list
274 0 0 if (ref $body eq "ARRAY")
275 0 0 if @$body
285 0 0 if ($log)
303 0 0 if $HTTP::Handy::ACCESS_LOG_FH
316 0 0 if $char eq "\n"
318 0 0 if length $line > 8192
320 0 0 $line eq '' ? :
350 2 0 if ($] >= 5.006) { }
352 0 2 unless eval " open(\$fh, '>>', 'logs/error/error.log') "
356 0 0 unless open $fh, ">> logs/error/error.log"
377 3 17 if ($path =~ /\.\./)
390 2 15 if (-d $file)
394 2 15 unless (-f $file)
400 15 0 if ($file =~ /\.([^.]+)$/)
407 15 0 if ($] >= 5.006) { }
409 0 15 unless (eval " open(\$fh, '<', \$file) ")
415 0 0 unless (open $fh, "<$file")
426 3 12 if (exists $opts{'cache_max_age'}) { }
428 2 1 if ($age > 0) { }
452 1 28 unless defined $str
463 2 6 unless defined $query and $query ne ""
467 0 10 unless defined $key
469 9 1 defined $val ? :
470 2 8 if (exists $params{$key}) { }
471 1 1 if (ref $params{$key} eq 'ARRAY') { }
500 2 3 defined $env->{'HTTP_HX_REQUEST'} && $env->{'HTTP_HX_REQUEST'} eq 'true' ? :
563 6 12 unless -d $dir
580 1 1 if defined $HTTP::Handy::ACCESS_LOG_FH and $current_log_filename eq $HTTP::Handy::CURRENT_LOG_FILE
582 0 1 if ($HTTP::Handy::ACCESS_LOG_FH)
587 1 0 if ($] >= 5.006) { }
589 0 1 unless (eval " open(\$fh, '>>', \$current_log_filename) ")
596 0 0 unless (open $fh, ">> $current_log_filename")
632 0 2 unless defined $data
645 1 1 if $length > $remaining
646 1 1 if $length <= 0
657 2 0 if ($whence == 0) { }
0 0 elsif ($whence == 1) { }
0 0 elsif ($whence == 2) { }
666 0 2 if $self->{'pos'} < 0
677 3 4 if $self->{'pos'} >= length $self->{'data'}
680 0 4 if ($nl < 0) { }