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