blib/lib/YATT/Lite/CLI/Render.pm

filter: Statementstmt 100% 32 / 32 Branchbran 100% 6 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 94.0% 47 / 50 CC 5 SCAR 11.0
CC
5
Cov
98%
main
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« blib/lib/YATT/Lite/VarMaker.pm ↑ Summary blib/lib/YATT/Lite/CLI/GenPerl.pm »
1 package YATT::Lite::CLI::Render; sub MY () {__PACKAGE__}
2 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 7 ▶use warnings qw(FATAL all NONFATAL misc);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 7 ▶use mro 'c3';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 7 ▶use parent qw(YATT::Lite::CLI);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 7 ▶use YATT::Lite::MFields;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 #========================================
10 # yatt.render FILE [name=value..] [FILE2 [name=value..] ..]
11 #
12 # name=value params before the first file are common to all files;
13 # params right after a file apply to that file (overriding common ones).
14 #
15 # Dispatch (part resolution, sigil, public check, argument reordering)
16 # is identical to the web thanks to Site->render_file. Raw die from a
17 # template passes through untouched (perl -d friendly).
18 #========================================
19  
20 9 ▶sub main {
Subroutine main: called CC=5 SCAR=16.1
Pod undocumented
21 9 my ($self, @argv) = @_;
22 9 $self->parse_params(\@argv, \ my %common);
23  
24 9 binmode STDOUT;
25  
26 9 my $nerror = 0;
27 9 ▶ while (@argv) {
Branch: 1 branch
BranchTrueFalseTotal
if (@argv) 10 8 18
28 10 my $file = shift @argv;
29 10 my %params = %common;
30 10 $self->parse_params(\@argv, \%params);
31  
32 10 my $site = $self->site_for($file);
33 10 my $res = $site->render_file($file, \%params);
34 9 ▶ if ($res->is_success) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res->is_success) { } 7 2 9
35 7 print scalar $res->body;
36 } else {
37 2 ▶ print STDERR join(" ", grep {defined $_ and $_ ne ''}
Condition66%2/3
defined $_ && $_ ne ''
!ll&&!rl&&r
013
MC/DC50%1/2
defined $_ && $_ ne ''
defined $_ $_ ne ''
Truth table66%2/3
A && B
A= defined $_B= $_ ne ''
ABresult
0X0
100
111
38 $res->status, $res->content), "\n";
39 2 $nerror++;
40 }
41 }
42 8 ▶ $nerror ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$nerror ? : 2 6 8
43 }
44  
45 7 1;
« blib/lib/YATT/Lite/VarMaker.pm ↑ Summary blib/lib/YATT/Lite/CLI/GenPerl.pm »