blib/lib/DTL/Fast/Text.pm

filter: Statementstmt 100% 29 / 29 Branchbran 100% 2 / 2 Conditioncond 100% 4 / 4 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 3 totaltotal 93.7% 45 / 48 SCAR 13.9
CC
4
Cov
100%
new
2.0
append
2.0
render
2.0
CRAP 4.0
« blib/lib/DTL/Fast/Tag/Now.pm ↑ Summary blib/lib/DTL/Fast/Filter/Yesno.pm »
1 package DTL::Fast::Text;
2 98 ▶use strict; use utf8; use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 98 ▶use DTL::Fast::Template;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 98 ▶use Scalar::Util qw/weaken/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 sub new
8 {
9 2392 ▶ my ($proto, $text ) = @_;
Subroutine new: called CC=2 SCAR=6.9
Pod undocumented
10 2392 ▶ $text //= '';
Condition100%2/2
$text //= ""
l!l
236428
MC/DC100%1/1
$text //= ""
$text
Truth table100%2/2
A
A= $text
Aresult
11
00
11
12 2392 my $self = bless {
13 'texts' => [$text]
14 , '_template' => $DTL::Fast::Template::CURRENT_TEMPLATE
15 , '_template_line' => $DTL::Fast::Template::CURRENT_TEMPLATE_LINE
16 }, $proto;
17  
18 2392 weaken $self->{'_template'};
19  
20 2392 return $self;
21 }
22  
23 sub append
24 {
25 108 ▶ my $self = shift;
Subroutine append: called CC=2 SCAR=6.9
Pod undocumented
26 108 ▶ $self->{'need_join'} ||= 1;
Condition100%2/2
$self->{"need_join"} ||= 1
l!l
8622
MC/DC100%1/1
$self->{"need_join"} ||= 1
$self->{"need_join"}
Truth table100%2/2
A
A= $self->{"need_join"}
Aresult
11
00
27 108 push @{$self->{'texts'}}, shift;
28 108 return $self;
29 }
30  
31 sub render
32 {
33 3078 ▶ my($self) = @_;
Subroutine render: called CC=2 SCAR=6.9
Pod undocumented
34 return $self->{'need_join'}
35 11 ? join '', @{$self->{'texts'}}
36 3078 ▶ : $self->{'texts'}->[0]
Branch: 1 branch
BranchTrueFalseTotal
$self->{'need_join'} ? : 11 3067 3078
37 ;
38 }
39  
40  
41 98 1;
« blib/lib/DTL/Fast/Tag/Now.pm ↑ Summary blib/lib/DTL/Fast/Filter/Yesno.pm »