| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 35 | 7 | print scalar $res->body; | |||||||||||||||||||
| 36 | } else { | ||||||||||||||||||||
| 37 | 2 | ▶ | print STDERR join(" ", grep {defined $_ and $_ ne ''} | ||||||||||||||||||
|
Condition66%2/3
defined $_ && $_ ne ''
MC/DC50%1/2
defined $_ && $_ ne ''
defined $_
$_ ne ''
Truth table66%2/3
A && B
A= defined $_B= $_ ne ''
| |||||||||||||||||||||
| 38 | $res->status, $res->content), "\n"; | ||||||||||||||||||||
| 39 | 2 | $nerror++; | |||||||||||||||||||
| 40 | } | ||||||||||||||||||||
| 41 | } | ||||||||||||||||||||
| 42 | 8 | ▶ | $nerror ? 1 : 0; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 7 | 1; | |||||||||||||||||||