line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Tag::BlockSuper; |
2
|
1
|
|
|
1
|
|
592
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
1
|
|
|
1
|
|
3
|
|
|
1
|
|
|
1
|
|
24
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
23
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
3
|
1
|
|
|
1
|
|
5
|
use parent 'DTL::Fast::Tag::Simple'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::TAG_HANDLERS{'block_super'} = __PACKAGE__; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#@Override |
8
|
|
|
|
|
|
|
sub render |
9
|
|
|
|
|
|
|
{ |
10
|
2
|
|
|
2
|
0
|
5
|
my( $self, $context ) = @_; |
11
|
2
|
|
|
|
|
4
|
my $result = ''; |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
|
|
4
|
my $ns = $context->{'ns'}->[-1]; |
14
|
|
|
|
|
|
|
|
15
|
2
|
50
|
33
|
|
|
12
|
if ( # there is an inheritance and we are in block |
16
|
|
|
|
|
|
|
my $descendants = $ns->{'_dtl_descendants'} |
17
|
|
|
|
|
|
|
and exists $ns->{'_dtl_rendering_block'} |
18
|
|
|
|
|
|
|
) |
19
|
|
|
|
|
|
|
{ |
20
|
2
|
|
|
|
|
4
|
my $current_template = $ns->{'_dtl_rendering_template'}; |
21
|
2
|
|
|
|
|
4
|
my $current_block_name = $ns->{'_dtl_rendering_block'}->{'block_name'}; |
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
|
|
6
|
for( my $i = 0; $i < scalar @$descendants; $i++ ) |
24
|
|
|
|
|
|
|
{ |
25
|
2
|
50
|
|
|
|
8
|
if ( $descendants->[$i] == $current_template ) # found self |
26
|
|
|
|
|
|
|
{ |
27
|
2
|
|
|
|
|
6
|
for( my $j = $i + 1; $j < scalar @$descendants; $j++ ) |
28
|
|
|
|
|
|
|
{ |
29
|
2
|
50
|
|
|
|
7
|
if ( $descendants->[$j]->{'blocks'}->{$current_block_name} ) # found parent block |
30
|
|
|
|
|
|
|
{ |
31
|
2
|
|
|
|
|
7
|
$context->push_scope(); |
32
|
2
|
|
|
|
|
4
|
$ns->{'_dtl_rendering_template'} = $descendants->[$j]; |
33
|
2
|
|
|
|
|
5
|
$ns->{'_dtl_rendering_block'} = $descendants->[$j]->{'blocks'}->{$current_block_name}; |
34
|
|
|
|
|
|
|
|
35
|
2
|
|
|
|
|
17
|
$result = $descendants->[$j]->{'blocks'}->{$current_block_name}->SUPER::render($context); |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
7
|
$context->pop_scope(); |
38
|
2
|
|
|
|
|
3
|
last; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
} |
42
|
2
|
|
|
|
|
5
|
last; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
2
|
|
|
|
|
9
|
return $result; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |