Branch Coverage

blib/lib/App/Phoebe.pm
Criterion Covered Total %
branch 0 514 0.0


line true false branch
198 0 0 unless $stream
207 0 0 if $err
210 0 0 if $err
211 0 0 if $ipaddr
231 0 0 if (keys %{$$server{'host'};} > 1) { }
0 0 elsif (@{$App::Phoebe::server->{'wiki_space'};}) { }
256 0 0 if ($lang) { }
275 0 0 unless $data->{'upload'} ||= is_upload($stream, $data->{'request'})
278 0 0 if ($actual == $size) { }
0 0 elsif ($actual > $size) { }
297 0 0 if (run_extensions($stream, $request, $upload, $buffer, $size)) { }
307 0 0 unless $@
323 0 0 if ($type ne 'text/plain' and $type ne 'text/gemini') { }
0 0 elsif ($length == 0) { }
0 0 elsif (utf8::decode($data)) { }
324 0 0 if ($length == 0) { }
367 0 0 if (-e $lock)
370 0 0 if -e $lock and $age > 5
372 0 0 if (mkdir $lock) { }
0 0 elsif ($count > 25) { }
375 0 0 if ($@)
405 0 0 if (-e $file) { }
407 0 0 if ($old eq $text)
412 0 0 unless -d "$dir/keep"
413 0 0 if (-d "$dir/keep/$id") { }
415 0 0 if /^(\d+)\.gmi$/u and $1 > $revision
425 0 0 if (not open(my $fh, '>>:encoding(UTF-8)', $index)) { }
435 0 0 if (not open(my $fh, '>>:encoding(UTF-8)', $changes)) { }
444 0 0 unless -d "$dir/page"
446 0 0 if ($@) { }
463 0 0 if (-e $file)
465 0 0 unless -d "$dir/keep"
466 0 0 if (-d "$dir/keep/$id") { }
468 0 0 if /^(\d+)\.gmi$/u and $1 > $revision
479 0 0 if (-f $index)
485 0 0 if (not open(my $fh, '>>:encoding(UTF-8)', $changes)) { }
503 0 0 if $data->{'buffer'}
524 0 0 if (run_extensions($stream, $url)) { }
0 0 elsif (not $url) { }
0 0 elsif (length $url > 1024) { }
0 0 elsif (($host, $n, $space) = $url =~ m[^(?:gemini:)?//($hosts)(:$port)?(?:/($spaces))?/(?:$reserved)$]u) { }
0 0 elsif (($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/?$]u) { }
0 0 elsif (($host, $space, $n) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/more(?:/(\d+))?$]u) { }
0 0 elsif (($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/index$]u) { }
0 0 elsif (($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/files$]u) { }
0 0 elsif (($host) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/spaces$]u) { }
0 0 elsif (($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/data$]u) { }
0 0 elsif ($url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/match$]u) { }
0 0 elsif ($query and ($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/match\?]u) { }
0 0 elsif ($url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/search$]u) { }
0 0 elsif ($query and ($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/search\?]u) { }
0 0 elsif ($url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/new$]u) { }
0 0 elsif ($query and ($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/new\?]u) { }
0 0 elsif (($host, $space, $n, $style) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/changes(?:/(\d+))?(?:/(colour|fancy))?$]u) { }
0 0 elsif (($host, $filter, $n, $style) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?/do/all(?:/(latest))?/changes(?:/(\d+))?(?:/(colour|fancy))?$]u) { }
0 0 elsif (($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/rss$]u) { }
0 0 elsif (($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/blog/rss$]u) { }
0 0 elsif (($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/atom$]u) { }
0 0 elsif (($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/blog/atom$]u) { }
0 0 elsif (($host, $space) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/do/all/atom$]u) { }
0 0 elsif (($host) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?/robots.txt(?:[#?].*)?$]u) { }
0 0 elsif (($host, $space, $id, $n, $style) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/history/([^/]*)(?:/(\d+))?(?:/(colour|fancy))?$]u) { }
0 0 elsif (($host, $space, $id, $n, $style) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/diff/([^/]*)(?:/(\d+))?(?:/(colour))?$]u) { }
0 0 elsif (($host, $space, $id, $n) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/raw/([^/]*)(?:/(\d+))?$]u) { }
0 0 elsif (($host, $space, $id, $n) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/html/([^/]*)(?:/(\d+))?$]u) { }
0 0 elsif (($host, $space, $id, $n) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/page/([^/]+)(?:/(\d+))?$]u) { }
0 0 elsif (($host, $space, $id) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(?:/($spaces))?/file/([^/]+)?$]u) { }
0 0 elsif (($host) = $url =~ m[^(?:gemini:)?//($hosts)(?::$port)?(/|$)]u) { }
0 0 elsif ($authority) { }
536 0 0 $n ? :
561 0 0 if ($space) { }
606 0 0 if $@
613 0 0 unless $query
621 0 0 if &$sub(@_)
633 0 0 if ($page) { }
654 0 0 if @{$App::Phoebe::server->{'wiki_space'};} or keys %{$$server{"host"};} > 1
664 0 0 if ($data->{'buffer'} =~ /^(.*)\r\n/u) { }
670 0 0 if ($data->{'request'} =~ /$re/iu)
691 0 0 if $data->{'buffer'}
704 0 0 if ($space)
705 0 0 if $space eq $host
712 0 0 $space ? :
721 0 0 unless ($id)
724 0 0 if $id =~ /^$full_url_regex$/u
754 0 0 unless (-f $index)
755 0 0 unless -d "$dir/page"
761 0 0 if $re
779 0 0 unless @blog
785 0 0 if @blog > $n
786 0 0 if $n == 10
787 0 0 if $n == 10
809 0 0 unless (@blog)
817 0 0 if @blog > $n
828 0 0 unless @pages
841 0 0 unless -d $dir
843 0 0 if $re
855 0 0 unless @files
881 0 0 if (-e $file and time - modified($file) <= 300) { }
893 0 0 if (system(@command) == 0) { }
909 0 0 unless ($match)
918 0 0 unless @pages
929 0 0 unless ($str)
937 0 0 if (not search($stream, $host, $space, $str, sub { highlight($stream, @_); } ))
949 0 0 unless @pages
953 0 0 if ($id =~ /$str/iu or $text =~ /$str/iu)
977 0 0 if (($j = index($text, $1)) > -1)
980 0 0 if $start == -1
982 0 0 if $end == -1
1002 0 0 if (not $style) { }
0 0 elsif ($style eq 'colour') { }
0 0 elsif ($style eq 'fancy') { }
1006 0 0 if @{$App::Phoebe::server->{'wiki_space'};}
1011 0 0 unless (-e $log)
1024 0 0 unless $_ = &decode_utf8(scalar $fh->readline)
1029 0 0 unless changes($stream, $n, sub { $stream->write(&encode_utf8("## " . (shift()) . "\n")); } , sub { $stream->write((shift()) . " by " . colourize($stream, shift(), $style) . "\n"); } , sub { print_link($stream, @_); } , sub { $stream->write(&encode_utf8(join("\n", @_, ""))); } , sub { return unless $_ = &decode_utf8(scalar $fh->readline); chomp $_; split(/\x1f/u, $_, 0), $host, $space, 0; } , undef, undef, $style)
1031 0 0 $style ? :
1040 0 0 $filter ? :
1045 0 0 unless (@$log)
1049 0 0 $filter ? :
1050 0 0 $style ? :
1051 0 0 if (not $style) { }
0 0 elsif ($style eq 'colour') { }
0 0 elsif ($style eq 'fancy') { }
1054 0 0 if ($filter) { }
1058 0 0 $filter ? :
1066 0 0 if @$log
1068 0 0 unless changes($stream, $n, sub { $stream->write("## " . (shift()) . "\n"); } , sub { $stream->write((shift()) . " by " . colourize($stream, shift(), $style) . "\n"); } , sub { print_link($stream, @_); } , sub { $stream->write(&encode_utf8(join("\n", @_, ""))); } , sub { @{shift @$log;}, 1 if @$log; } , undef, $filter, $style)
1071 0 0 $style ? :
1085 0 0 if $space
1087 0 0 unless -f $changes
1089 0 0 unless my $fh = "File::ReadBackwards"->new($changes)
1090 0 0 if (keys %{$$server{'host'};} > 1) { }
1111 0 0 unless $_ and $_ ne "\n"
1112 0 0 if $filter and not /$filter/u
1156 0 0 unless $ts and $id
1158 0 0 if $filter eq "latest" and $seen{$name}
1160 0 0 if ($day ne $last_day)
1165 0 0 if ($revision eq "\x{1f5b9}") { }
0 0 elsif ($revision eq "\x{1f5bb}") { }
0 0 elsif ($revision > 0) { }
1168 0 0 $style ? :
1176 0 0 if ($seen{$name}) { }
0 0 elsif ($filter eq 'latest') { }
1179 0 0 $style ? :
0 0 if &$kept($host, $space, $id, $revision)
1187 0 0 $style ? :
1192 0 0 if ($seen{$name . "\034"}) { }
1209 0 0 if ($show_space)
1210 0 0 if (keys %{$$server{'host'};} > 1) { }
0 0 elsif ($space) { }
1211 0 0 if ($space) { }
1228 0 0 unless $style
1229 0 0 if ($style eq 'colour') { }
0 0 elsif ($style eq 'fancy') { }
1274 0 0 if (-e $log and my $fh = "File::ReadBackwards"->new($log))
1277 0 0 unless $_ = &decode_utf8(scalar $fh->readline)
1280 0 0 if $seen{$id}
1353 0 0 if (-e $log and my $fh = "File::ReadBackwards"->new($log))
1355 0 0 unless $_ = &decode_utf8(scalar $fh->readline)
1358 0 0 if (&any(sub { $_ eq $id; } , @ids))
1377 0 0 unless $_ = &decode_utf8(scalar $fh->readline)
1389 0 0 if @$log
1421 0 0 unless $ts and $id
1423 0 0 if ($revision eq "\x{1f5b9}") { }
0 0 elsif ($revision eq "\x{1f5bb}") { }
0 0 elsif ($revision > 0) { }
1424 0 0 if $seen{$name}
1431 0 0 if $seen{$name . "\34"}
1437 0 0 if $seen{$name}
1447 0 0 if $seen{$name . "\34"}
1458 0 0 if $ts gt $feed_ts
1506 0 0 if $ts gt $feed_ts
1534 0 0 if (not $style) { }
1539 0 0 if (not $style) { }
1542 0 0 unless $_
1543 0 0 unless $_
1548 0 0 unless $_
1549 0 0 unless $_
1567 0 0 if $diff->Same
1570 0 0 if ($diff->Diff == 3) { }
0 0 elsif ($diff->Diff == 2) { }
0 0 elsif ($diff->Diff == 1) { }
1572 0 0 $min1 == $max1 ? :
1574 0 0 $min2 == $max2 ? :
1577 0 0 $min2 == $max2 ? :
1580 0 0 $min1 == $max1 ? :
1597 0 0 if (my(@list) = $diff->Same) { }
1602 0 0 $_ ? :
1603 0 0 $_ ? :
1650 0 0 if (/^```(?:type=([a-z]+))?/u) { }
0 0 elsif ($code) { }
0 0 elsif (/^\* +(.*)/u) { }
0 0 elsif (my($url, $text) = /^=>\s*(\S+)\s*(.*)/u) { }
0 0 elsif (/^(#{1,6})\s*(.*)/u) { }
0 0 elsif (/^>\s*(.*)/u) { }
1652 0 0 if ($code) { }
1656 0 0 if $list
1664 0 0 unless $list
1668 0 0 unless $list
1673 0 0 if $list
1678 0 0 if $list
1682 0 0 if $list
1687 0 0 if $code
1688 0 0 if $list
1701 0 0 if $html =~ /\S/u
1732 0 0 if (not $style) { }
0 0 elsif ($style eq 'colour') { }
0 0 elsif ($style eq 'fancy') { }
1737 0 0 unless (-e $log)
1750 0 0 unless $_ = &decode_utf8(scalar $fh->readline)
1754 0 0 if $id_log ne $id
1758 0 0 unless changes($stream, $n, sub { $stream->write("## " . (shift()) . "\n"); } , sub { $stream->write((shift()) . " by " . colourize($stream, shift(), $style) . "\n"); } , sub { print_link($stream, @_); } , sub { $stream->write(join("\n", @_, "")); } , sub { READ: return unless $_ = &decode_utf8(scalar $fh->readline); chomp $_; my($ts, $id_log, $revision, $code) = split(/\x1f/u, $_, 5); goto READ if $id_log ne $id; $ts, $id_log, $revision, $code, $host, $space, 0; } , undef, undef, $style)
1760 0 0 $style ? :
1797 0 0 if $revision and -f "$dir/keep/$id/$revision.gmi"
1798 0 0 if -f "$dir/page/$id.gmi"
1799 0 0 if $id eq "robots" and not $space
1800 0 0 if $revision
1846 0 0 if (not -f $file) { }
0 0 elsif (not -f $meta) { }
1854 0 0 unless ($meta{'content-type'})
1864 0 0 unless $str
1881 0 0 if (-e $file)
1883 0 0 if ($old eq $data)
1890 0 0 if (not open(my $fh, '>>:encoding(UTF-8)', $changes)) { }
1899 0 0 unless -d "$dir/file"
1901 0 0 if ($@)
1905 0 0 unless -d "$dir/meta"
1907 0 0 if ($@)
1924 0 0 if (not open(my $fh, '>>:encoding(UTF-8)', $changes)) { }
1949 0 0 if (keys %{$$server{"host"};} > 1)
1951 0 0 unless -d $dir
1953 0 0 if $space
1954 0 0 unless -d $dir
1964 0 0 if $space
1965 0 0 if (keys %{$$server{"host"};} > 1)
1966 0 0 unless $space
1967 0 0 if grep {$_ eq "$host/$space";} @{$$server{"wiki_space"};}
1979 0 0 if (keys %{$$server{'host'};} > 1) { }
1997 0 0 if (keys %{$$server{'host'};} > 1) { }
0 0 elsif (@{$App::Phoebe::server->{'wiki_space'};}) { }
2021 0 0 if ($request =~ m[^titan://($hosts)(?::$port)?]u)
2025 0 0 if ($path =~ m[^(?:/($spaces_regex))?(?:/raw|/page|/file)?/([^/;=&]+(?:;\w+=[^;=&]+)+)]u) { }
2029 0 0 if (valid_params($stream, $host, $space, $id, $params))
2052 0 0 unless valid_id($stream, $host, $space, $id, $params)
2053 0 0 unless valid_token($stream, $host, $space, $id, $params)
2054 0 0 unless valid_mime_type($stream, $host, $space, $id, $params)
2055 0 0 unless valid_size($stream, $host, $space, $id, $params)
2064 0 0 if (not $id) { }
0 0 elsif ($id =~ /[[:cntrl:]]/u) { }
2087 0 0 if $space and $App::Phoebe::server->{'wiki_space_token'}{$space}
2090 0 0 if (not $token and @tokens) { }
0 0 elsif (not grep(/^$token$/u, @tokens)) { }
2114 0 0 if ($type eq 'text/plain' or $type eq 'text/gemini') { }
0 0 elsif (not @types) { }
0 0 elsif (not grep(/^$type$/u, @types) || grep(/^$main_type$/u, @types)) { }
2137 0 0 if (not $size =~ /^\d+$/u) { }
0 0 elsif ($size > $App::Phoebe::server->{'wiki_page_size_limit'}) { }