blib/lib/App/texttable.pm

filter: Statementstmt 73.0% 19 / 26 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 100% 1 / 1 totaltotal 65.7% 25 / 38 CC 3 SCAR 15.6
CC
3
Cov
63%
texttable
12.0
__ANON__
2.0
BEGIN
1.0
CRAP 4.8
↑ Summary
1 package App::texttable;
2  
3 1 our $DATE = '2019-02-24'; # DATE
4 1 our $VERSION = '0.031'; # VERSION
5  
6 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use PerlX::Maybe;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Text::Table::Any;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 our %SPEC;
14  
15 $SPEC{texttable} = {
16 v => 1.1,
17 summary => 'Render a text table using Text::Table::Any',
18 args => {
19 action => {
20 schema => ['str*', in=>['list_backends', 'gen_table']],
21 default => 'gen_table',
22 cmdline_aliases => {
23 0 ▶ l => {is_flag=>1, summary => 'Shortcut for --action=list_backends', code=>sub {$_[0]{action}='list_backends'}},
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 },
25 },
26 1 rows => {
27 summary => 'Table rows',
28 schema => ['array*', of=>['array*', of=>'str*']],
29 },
30 header_row => {
31 schema => 'bool*',
32 default => 0,
33 },
34 backend => {
35 schema => ['str*', in=>\@Text::Table::Any::BACKENDS],
36 cmdline_aliases => {b=>{}},
37 },
38 },
39 'cmdline.skip_format' => 1,
40 examples => [
41 {
42 args=> {rows=>[ ['Name','Gender','Age'],
43 ['ujang','M',28],['iteung','F',25] ]}},
44 {
45 summary => 'List available backends',
46 argv => ['-l'],
47 'x.doc.show_result' => 0,
48 },
49  
50 ],
51 result_naked => 1,
52 };
53 0 ▶sub texttable {
Subroutine texttable: not called CC=3 SCAR=24.8
Pod documented
54 0 my %args = @_;
55  
56 0 ▶ if ($args{action} eq 'list_backends') {
Branch: 1 branch
BranchTrueFalseTotal
if ($args{'action'} eq 'list_backends') { } 0 0 0
57 0 join("", map {"$_\n"} @Text::Table::Any::BACKENDS);
58 } else {
59 0 ▶ die "Please specify rows" unless $args{rows};
Branch: 1 branch
BranchTrueFalseTotal
unless $args{"rows"} 0 0 0
60 Text::Table::Any::table(
61 rows => $args{rows},
62 header_row => $args{header_row},
63 maybe backend => $args{backend},
64 0 );
65 }
66 }
67  
68 1 1;
69 # ABSTRACT: Generate text table using Text::Table::Any
70  
71 __END__
↑ Summary