Branch Coverage

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


line true false branch
169 0 0 unless $stream
178 0 0 if $err
181 0 0 if $err
182 0 0 if $ipaddr
201 0 0 if (keys %{$$server{'host'};} > 1) { }
0 0 elsif (@{$App::Phoebe::server->{'wiki_space'};}) { }
226 0 0 if ($lang) { }
245 0 0 unless $data->{'upload'} ||= is_upload($stream, $data->{'request'})
248 0 0 if ($actual == $size) { }
0 0 elsif ($actual > $size) { }
271 0 0 unless $@
284 0 0 if ($type ne 'text/plain') { }
0 0 elsif ($length == 0) { }
0 0 elsif (utf8::decode($data)) { }
285 0 0 if ($length == 0) { }
312 0 0 if (-e $lock)
315 0 0 if -e $lock and $age > 5
317 0 0 if (mkdir $lock) { }
0 0 elsif ($count > 25) { }
320 0 0 if ($@)
348 0 0 if (-e $file) { }
350 0 0 if ($old eq $text)
355 0 0 unless -d "$dir/keep"
356 0 0 if (-d "$dir/keep/$id") { }
358 0 0 if /^(\d+)\.gmi$/u and $1 > $revision
368 0 0 if (not open(my $fh, '>>:encoding(UTF-8)', $index)) { }
378 0 0 if (not open(my $fh, '>>:encoding(UTF-8)', $changes)) { }
387 0 0 unless -d "$dir/page"
389 0 0 if ($@) { }
406 0 0 if (-e $file)
408 0 0 unless -d "$dir/keep"
409 0 0 if (-d "$dir/keep/$id") { }
411 0 0 if /^(\d+)\.gmi$/u and $1 > $revision
422 0 0 if (-f $index)
428 0 0 if (not open(my $fh, '>>:encoding(UTF-8)', $changes)) { }
446 0 0 if $data->{'buffer'}
467 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) { }
479 0 0 $n ? :
504 0 0 if ($space) { }
549 0 0 if $@
556 0 0 if &$sub(@_)
568 0 0 if ($page) { }
589 0 0 if @{$App::Phoebe::server->{'wiki_space'};} or keys %{$$server{'host'};} > 1
599 0 0 if ($data->{'buffer'} =~ /^(.*)\r\n/u) { }
605 0 0 if ($data->{'request'} =~ /$re/iu)
626 0 0 if $data->{'buffer'}
639 0 0 if ($space)
640 0 0 if $space eq $host
647 0 0 $space ? :
656 0 0 unless ($id)
659 0 0 if $id =~ /^$full_url_regex$/u
689 0 0 unless (-f $index)
690 0 0 unless -d "$dir/page"
696 0 0 if $re
714 0 0 unless @blog
720 0 0 if @blog > $n
721 0 0 if $n == 10
722 0 0 if $n == 10
744 0 0 unless (@blog)
752 0 0 if @blog > $n
763 0 0 unless @pages
776 0 0 unless -d $dir
778 0 0 if $re
790 0 0 unless @files
816 0 0 if (-e $file and time - modified($file) <= 300) { }
828 0 0 if (system(@command) == 0) { }
844 0 0 unless ($match)
853 0 0 unless @pages
864 0 0 unless ($str)
872 0 0 if (not search($stream, $host, $space, $str, sub { highlight($stream, @_); } ))
884 0 0 unless @pages
888 0 0 if ($id =~ /$str/iu or $text =~ /$str/iu)
912 0 0 if (($j = index($text, $1)) > -1)
915 0 0 if $start == -1
917 0 0 if $end == -1
937 0 0 if (not $style) { }
0 0 elsif ($style eq 'colour') { }
0 0 elsif ($style eq 'fancy') { }
941 0 0 if @{$App::Phoebe::server->{'wiki_space'};}
946 0 0 unless (-e $log)
959 0 0 unless $_ = &decode_utf8(scalar $fh->readline)
961 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; } )
963 0 0 $style ? :
972 0 0 $filter ? :
977 0 0 unless (@$log)
981 0 0 $filter ? :
982 0 0 $style ? :
983 0 0 if (not $style) { }
0 0 elsif ($style eq 'colour') { }
0 0 elsif ($style eq 'fancy') { }
986 0 0 if ($filter) { }
990 0 0 $filter ? :
998 0 0 if @$log
1000 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)
1002 0 0 $style ? :
1016 0 0 if $space
1018 0 0 unless -f $changes
1020 0 0 unless my $fh = 'File::ReadBackwards'->new($changes)
1021 0 0 if (keys %{$$server{'host'};} > 1) { }
1042 0 0 unless $_ and $_ ne "\n"
1043 0 0 if $filter and not /$filter/u
1085 0 0 unless $ts and $id
1087 0 0 if $filter eq 'latest' and $seen{$name}
1089 0 0 if ($day ne $last_day)
1094 0 0 if ($revision eq "\x{1f5b9}") { }
0 0 elsif ($revision eq "\x{1f5bb}") { }
0 0 elsif ($revision > 0) { }
1105 0 0 if ($seen{$name}) { }
0 0 elsif ($filter eq 'latest') { }
1107 0 0 if &$kept($host, $space, $id, $revision)
1119 0 0 if ($seen{$name . "\034"}) { }
1136 0 0 if ($show_space)
1137 0 0 if (keys %{$$server{'host'};} > 1) { }
0 0 elsif ($space) { }
1138 0 0 if ($space) { }
1155 0 0 unless $style
1156 0 0 if ($style eq 'colour') { }
0 0 elsif ($style eq 'fancy') { }
1201 0 0 if (-e $log and my $fh = 'File::ReadBackwards'->new($log))
1204 0 0 unless $_ = &decode_utf8(scalar $fh->readline)
1207 0 0 if $seen{$id}
1280 0 0 if (-e $log and my $fh = 'File::ReadBackwards'->new($log))
1282 0 0 unless $_ = &decode_utf8(scalar $fh->readline)
1285 0 0 if (&any(sub { $_ eq $id; } , @ids))
1304 0 0 unless $_ = &decode_utf8(scalar $fh->readline)
1316 0 0 if @$log
1348 0 0 unless $ts and $id
1350 0 0 if ($revision eq "\x{1f5b9}") { }
0 0 elsif ($revision eq "\x{1f5bb}") { }
0 0 elsif ($revision > 0) { }
1351 0 0 if $seen{$name}
1358 0 0 if $seen{$name . "\034"}
1364 0 0 if $seen{$name}
1374 0 0 if $seen{$name . "\034"}
1385 0 0 if $ts gt $feed_ts
1433 0 0 if $ts gt $feed_ts
1461 0 0 if (not $style) { }
1466 0 0 if (not $style) { }
1469 0 0 unless $_
1470 0 0 unless $_
1475 0 0 unless $_
1476 0 0 unless $_
1494 0 0 if $diff->Same
1497 0 0 if ($diff->Diff == 3) { }
0 0 elsif ($diff->Diff == 2) { }
0 0 elsif ($diff->Diff == 1) { }
1499 0 0 $min1 == $max1 ? :
1501 0 0 $min2 == $max2 ? :
1504 0 0 $min2 == $max2 ? :
1507 0 0 $min1 == $max1 ? :
1524 0 0 if (my(@list) = $diff->Same) { }
1529 0 0 $_ ? :
1530 0 0 $_ ? :
1577 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) { }
1579 0 0 if ($code) { }
1583 0 0 if $list
1591 0 0 unless $list
1595 0 0 unless $list
1600 0 0 if $list
1605 0 0 if $list
1609 0 0 if $list
1614 0 0 if $code
1615 0 0 if $list
1628 0 0 if $html =~ /\S/u
1659 0 0 if (not $style) { }
0 0 elsif ($style eq 'colour') { }
0 0 elsif ($style eq 'fancy') { }
1664 0 0 unless (-e $log)
1677 0 0 unless $_ = &decode_utf8(scalar $fh->readline)
1681 0 0 if $id_log ne $id
1682 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; } )
1684 0 0 $style ? :
1721 0 0 if $revision and -f "$dir/keep/$id/$revision.gmi"
1722 0 0 if -f "$dir/page/$id.gmi"
1723 0 0 if $id eq 'robots' and not $space
1724 0 0 if $revision
1770 0 0 if (not -f $file) { }
0 0 elsif (not -f $meta) { }
1778 0 0 unless ($meta{'content-type'})
1788 0 0 unless $str
1805 0 0 if (-e $file)
1807 0 0 if ($old eq $data)
1814 0 0 if (not open(my $fh, '>>:encoding(UTF-8)', $changes)) { }
1823 0 0 unless -d "$dir/file"
1825 0 0 if ($@)
1829 0 0 unless -d "$dir/meta"
1831 0 0 if ($@)
1848 0 0 if (not open(my $fh, '>>:encoding(UTF-8)', $changes)) { }
1873 0 0 if (keys %{$$server{'host'};} > 1)
1875 0 0 unless -d $dir
1877 0 0 if $space
1878 0 0 unless -d $dir
1888 0 0 if $space
1889 0 0 if (keys %{$$server{'host'};} > 1)
1890 0 0 unless $space
1891 0 0 if grep {$_ eq "$host/$space";} @{$$server{'wiki_space'};}
1904 0 0 if (keys %{$$server{'host'};} > 1) { }
1922 0 0 if (keys %{$$server{'host'};} > 1) { }
0 0 elsif (@{$App::Phoebe::server->{'wiki_space'};}) { }
1946 0 0 if ($request =~ m[^titan://($hosts)(?::$port)?]u)
1950 0 0 if ($path =~ m[^(?:/($spaces_regex))?(?:/raw)?/([^/;=&]+(?:;\w+=[^;=&]+)+)]u) { }
1954 0 0 if (valid_params($stream, $host, $space, $id, $params))
1977 0 0 unless valid_id($stream, $host, $space, $id, $params)
1978 0 0 unless valid_token($stream, $host, $space, $id, $params)
1979 0 0 unless valid_mime_type($stream, $host, $space, $id, $params)
1980 0 0 unless valid_size($stream, $host, $space, $id, $params)
1989 0 0 if (not $id) { }
0 0 elsif ($id =~ /[[:cntrl:]]/u) { }
2012 0 0 if $space and $App::Phoebe::server->{'wiki_space_token'}{$space}
2015 0 0 if (not $token and @tokens) { }
0 0 elsif (not grep(/^$token$/u, @tokens)) { }
2038 0 0 if (not $type) { }
0 0 elsif ($type ne 'text/plain' and not grep(/^$type$/u, @types) and not grep(/^$main_type$/u, @types)) { }
2059 0 0 if (not $size =~ /^\d+$/u) { }
0 0 elsif ($size > $App::Phoebe::server->{'wiki_page_size_limit'}) { }