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

filter: Statementstmt 100% 32 / 32 Branchbran 50.0% 5 / 10 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 81.1% 43 / 53 SCAR 19.7
CC
7
Cov
84%
render
7.6
BEGIN
1.0
BEGIN
1.0
CRAP 7.2
« blib/lib/DTL/Fast/Filter/Join.pm ↑ Summary blib/lib/DTL/Fast/Tag/Cycle.pm »
1 package DTL::Fast::Tag::BlockSuper;
2 1 ▶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 1 ▶use parent 'DTL::Fast::Tag::Simple';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 $DTL::Fast::TAG_HANDLERS{'block_super'} = __PACKAGE__;
6  
7 #@Override
8 sub render
9 {
10 2 ▶ my( $self, $context ) = @_;
Subroutine render: called CC=7 SCAR=20.2
Pod undocumented
11 2 my $result = '';
12
13 2 my $ns = $context->{'ns'}->[-1];
14
15 2 ▶ if ( # there is an inheritance and we are in block
Branch: 1 branch
BranchTrueFalseTotal
if (my $descendants = $ns->{"_dtl_descendants"} and exists $ns->{"_dtl_rendering_block"}) 2 0 2
Condition33%1/3
my $descendants = $ns->{"_dtl_descendants"} and exists $ns->{"_dtl_rendering_block"}
!ll&&!rl&&r
002
MC/DC0%0/2
my $descendants = $ns->{"_dtl_descendants"} and exists $ns->{"_dtl_rendering_block"}
my $descendants = $ns->{"_dtl_descendants"} exists $ns->{"_dtl_rendering_block"}
Truth table33%1/3
A and B
A= my $descendants = $ns->{"_dtl_descendants"}B= exists $ns->{"_dtl_rendering_block"}
ABresult
0X0
100
111
16 my $descendants = $ns->{'_dtl_descendants'}
17 and exists $ns->{'_dtl_rendering_block'}
18 )
19 {
20 2 my $current_template = $ns->{'_dtl_rendering_template'};
21 2 my $current_block_name = $ns->{'_dtl_rendering_block'}->{'block_name'};
22
23 2 ▶ for( my $i = 0; $i < scalar @$descendants; $i++ )
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @$descendants) 2 0 2
24 {
25 2 ▶ if ( $descendants->[$i] == $current_template ) # found self
Branch: 1 branch
BranchTrueFalseTotal
if ($descendants->[$i] == $current_template) 2 0 2
26 {
27 2 ▶ for( my $j = $i + 1; $j < scalar @$descendants; $j++ )
Branch: 1 branch
BranchTrueFalseTotal
if ($j < scalar @$descendants) 2 0 2
28 {
29 2 ▶ if ( $descendants->[$j]->{'blocks'}->{$current_block_name} ) # found parent block
Branch: 1 branch
BranchTrueFalseTotal
if ($descendants->[$j]{"blocks"}{$current_block_name}) 2 0 2
30 {
31 2 $context->push_scope();
32 2 $ns->{'_dtl_rendering_template'} = $descendants->[$j];
33 2 $ns->{'_dtl_rendering_block'} = $descendants->[$j]->{'blocks'}->{$current_block_name};
34
35 2 $result = $descendants->[$j]->{'blocks'}->{$current_block_name}->SUPER::render($context);
36
37 2 $context->pop_scope();
38 2 last;
39 }
40
41 }
42 2 last;
43 }
44
45 }
46 }
47
48 2 return $result;
49 }
50  
51 1 1;
« blib/lib/DTL/Fast/Filter/Join.pm ↑ Summary blib/lib/DTL/Fast/Tag/Cycle.pm »