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

filter: Statementstmt 100% 32 / 32 Branchbran 100% 6 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 90.0% 45 / 50 CC 5 SCAR 11.0
CC
5
Cov
95%
main
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« blib/lib/YATT/Lite/VarTypes.pm ↑ Summary blib/lib/YATT/Lite/VarMaker.pm »
1 package YATT::Lite::CLI::Render; sub MY () {__PACKAGE__}
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings qw(FATAL all NONFATAL misc);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use mro 'c3';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use parent qw(YATT::Lite::CLI);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶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 5 ▶sub main {
Subroutine main: called CC=5 SCAR=16.1
Pod undocumented
21 5 my ($self, @argv) = @_;
22 5 $self->parse_params(\@argv, \ my %common);
23  
24 5 binmode STDOUT;
25  
26 5 my $nerror = 0;
27 5 ▶ while (@argv) {
Branch: 1 branch
BranchTrueFalseTotal
if (@argv) 6 4 10
28 6 my $file = shift @argv;
29 6 my %params = %common;
30 6 $self->parse_params(\@argv, \%params);
31  
32 6 my $site = $self->site_for($file);
33 6 my $res = $site->render_file($file, \%params);
34 5 ▶ if ($res->is_success) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res->is_success) { } 4 1 5
35 4 print scalar $res->body;
36 } else {
37 1 ▶ print STDERR join(" ", grep {defined $_ and $_ ne ''}
Condition33%1/3
defined $_ && $_ ne ''
!ll&&!rl&&r
002
MC/DC0%0/2
defined $_ && $_ ne ''
defined $_ $_ ne ''
Truth table33%1/3
A && B
A= defined $_B= $_ ne ''
ABresult
0X0
100
111
38 $res->status, $res->content), "\n";
39 1 $nerror++;
40 }
41 }
42 4 ▶ $nerror ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$nerror ? : 1 3 4
43 }
44  
45 3 1;
« blib/lib/YATT/Lite/VarTypes.pm ↑ Summary blib/lib/YATT/Lite/VarMaker.pm »