App/TDWTF.pm

filter: Statementstmt 54.2% 19 / 35 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 60.0% 6 / 10 Podpod 0.0% 0 / 4 totaltotal 41.6% 25 / 60 CC 9 SCAR 26.3
CC
9
Cov
42%
run
30.0
print_series
20.0
print_list
6.0
CRAP 13.9
↑ Summary WebService/TDWTF.pm »
1 package App::TDWTF;
2  
3 1 ▶use 5.014000;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Encode qw/encode/;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use HTML::FormatText;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use WebService::TDWTF;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 our $VERSION = '0.003';
12  
13 0 ▶sub print_list {
Subroutine print_list: not called CC=2 SCAR=17.9
Pod undocumented
14 0 my $idlen = length $_[0]->Id;
15 0 for my $art (@_) {
16 0 my $str = sprintf "%${idlen}d %s (by %s) in %s on %s\n", $art->Id, $art->Title, $art->AuthorName, $art->SeriesTitle, $art->DisplayDate;
17 0 print encode 'UTF-8', $str;
18 }
19 }
20  
21 0 ▶sub print_article {
Subroutine print_article: not called CC=1 SCAR=6.9
Pod undocumented
22 0 my ($art) = @_;
23 0 printf "%s (by %s) in %s on %s\n\n", $art->Title, $art->AuthorName, $art->SeriesTitle, $art->DisplayDate;
24 0 say HTML::FormatText->format_string($art->Body)
25 }
26  
27 0 ▶sub print_series {
Subroutine print_series: not called CC=4 SCAR=30.0
Pod undocumented
28 0 for my $series (tdwtf_series) {
29 0 ▶ $series->{$_} = encode 'UTF-8', ($series->{$_} // '') for keys %$series;
Condition0%0/2
$series->{$_} // ""
l!l
00
MC/DC0%0/1
$series->{$_} // ""
$series->{$_}
Truth table0%0/2
A
A= $series->{$_}
Aresult
11
00
30 0 say $series->{Slug}, ' ', $series->{Title}, "\n", $series->{Description}, "\n";
31 }
32 }
33  
34 0 ▶sub run {
Subroutine run: not called CC=5 SCAR=34.0
Pod undocumented
35 0 my ($args, @argv) = @_;
36 0 ▶ return print_series if $args->{show_series};
Branch: 1 branch
BranchTrueFalseTotal
if $args->{"show_series"} 0 0 0
37 0 ▶ return print_list tdwtf_list_recent @argv if $args->{recent};
Branch: 1 branch
BranchTrueFalseTotal
if $args->{"recent"} 0 0 0
38 0 ▶ return print_list tdwtf_list_series @argv if $args->{series};
Branch: 1 branch
BranchTrueFalseTotal
if $args->{"series"} 0 0 0
39 0 ▶ return print_list tdwtf_list_author @argv if $args->{author};
Branch: 1 branch
BranchTrueFalseTotal
if $args->{"author"} 0 0 0
40 0 print_article tdwtf_article @argv
41 }
42  
43 1 1;
↑ Summary WebService/TDWTF.pm »