blib/lib/DTL/Fast/Tag/Cycle.pm

filter: Statementstmt 100% 37 / 37 Branchbran 100% 6 / 6 Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 3 totaltotal 85.4% 53 / 62 SCAR 19.5
CC
7
Cov
94%
parse_parameters
4.2
render
3.0
get_next_source
2.0
CRAP 7.0
« blib/lib/DTL/Fast/Tag/BlockSuper.pm ↑ Summary blib/lib/DTL/Fast/Filter/Urlize.pm »
1 package DTL::Fast::Tag::Cycle;
2 2 ▶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 2 ▶use parent 'DTL::Fast::Tag::Simple';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 $DTL::Fast::TAG_HANDLERS{'cycle'} = __PACKAGE__;
6  
7 #@Override
8 sub parse_parameters
9 {
10 11 ▶ my $self = shift;
Subroutine parse_parameters: called CC=4 SCAR=14.5
Pod undocumented
11
12 11 $self->{'parameter'} =~ /^\s*(.+?)\s*(?:as (.+?)\s*(silent)?)?\s*$/;
13 11 ▶ @{$self}{'source', 'destination', 'silent', 'sources', 'current_sources'} = ($1 // '', $2 // '', $3 // '', [], []);
Condition50%3/6
$1 // ""
l!l
110
$2 // ""
l!l
110
$3 // ""
l!l
011
MC/DC0%0/1
$1 // ""
$1
MC/DC0%0/1
$2 // ""
$2
MC/DC0%0/1
$3 // ""
$3
Truth table50%1/2
A
A= $1
Aresult
11
00
Truth table50%1/2
A
A= $2
Aresult
11
00
Truth table50%1/2
A
A= $3
Aresult
11
00
14 11 $self->{'sources'} = $self->parse_sources($self->{'source'});
15
16 11 return $self;
17 }
18  
19 #@Override
20 sub render
21 {
22 53 ▶ my( $self, $context, $global_safe) = @_;
Subroutine render: called CC=3 SCAR=11.0
Pod undocumented
23 53 my $result = '';
24
25 53 my $source = $self->get_next_source();
26 53 my $current_value = $source->render($context, $global_safe);
27
28 53 ▶ if( not $self->{'silent'} )
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"silent"}) 43 10 53
29 {
30 43 $result = $current_value;
31 }
32
33 53 ▶ if( $self->{'destination'} )
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"destination"}) 20 33 53
34 {
35 20 $context->set( $self->{'destination'} => $current_value );
36 }
37
38 53 return $result;
39 }
40  
41 sub get_next_source
42 {
43 53 ▶ my $self = shift;
Subroutine get_next_source: called CC=2 SCAR=6.9
Pod undocumented
44
45 53 ▶ if( not scalar @{$self->{'current_sources'}} ) # populate for current cycle
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar @{$self->{"current_sources"};}) 18 35 53
46 {
47 18 push @{$self->{'current_sources'}}, @{$self->{'sources'}};
48 }
49
50 53 return shift @{$self->{'current_sources'}};
51 }
52  
53 2 1;
« blib/lib/DTL/Fast/Tag/BlockSuper.pm ↑ Summary blib/lib/DTL/Fast/Filter/Urlize.pm »