line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Tag::Include; |
2
|
5
|
|
|
5
|
|
2639
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
5
|
|
|
5
|
|
9
|
|
|
5
|
|
|
5
|
|
135
|
|
|
5
|
|
|
|
|
18
|
|
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
25
|
|
|
5
|
|
|
|
|
114
|
|
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
189
|
|
3
|
5
|
|
|
5
|
|
23
|
use parent 'DTL::Fast::Tag::Simple'; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
30
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::TAG_HANDLERS{'include'} = __PACKAGE__; |
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
329
|
use DTL::Fast::Expression; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
1563
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#@Override |
10
|
|
|
|
|
|
|
sub new |
11
|
|
|
|
|
|
|
{ |
12
|
17
|
|
|
17
|
0
|
49
|
my( $proto, $parameter, %kwargs ) = @_; |
13
|
17
|
|
50
|
|
|
34
|
$parameter //= ''; |
14
|
|
|
|
|
|
|
|
15
|
17
|
|
|
|
|
49
|
my @parameter = split /\s+with\s+/, $parameter; |
16
|
|
|
|
|
|
|
|
17
|
17
|
|
|
|
|
74
|
my $self = $proto->SUPER::new( $parameter[0], %kwargs ); |
18
|
|
|
|
|
|
|
|
19
|
17
|
100
|
|
|
|
38
|
if( scalar @parameter > 1 ) # with used |
20
|
|
|
|
|
|
|
{ |
21
|
1
|
|
|
|
|
3
|
$kwargs{'raw_chunks'} = []; |
22
|
1
|
|
|
|
|
442
|
require DTL::Fast::Tag::With; |
23
|
1
|
|
|
|
|
11
|
$self = DTL::Fast::Tag::With->new($parameter[1], %kwargs)->add_chunk($self); |
24
|
|
|
|
|
|
|
} |
25
|
17
|
|
|
|
|
42
|
return $self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#@Override |
30
|
|
|
|
|
|
|
sub parse_parameters |
31
|
|
|
|
|
|
|
{ |
32
|
17
|
|
|
17
|
0
|
18
|
my $self = shift; |
33
|
17
|
|
|
|
|
102
|
$self->{'template'} = DTL::Fast::Expression->new($self->{'parameter'}); |
34
|
17
|
|
|
|
|
30
|
return $self; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#@Override |
38
|
|
|
|
|
|
|
sub render |
39
|
|
|
|
|
|
|
{ |
40
|
21
|
|
|
21
|
0
|
23
|
my ($self, $context) = @_; |
41
|
|
|
|
|
|
|
|
42
|
21
|
|
|
|
|
57
|
my $template_name = $self->{'template'}->render($context); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $result = DTL::Fast::get_template( |
45
|
|
|
|
|
|
|
$template_name |
46
|
21
|
|
|
|
|
56
|
, 'dirs' => $self->{'dirs'} |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
die $self->get_render_error( |
50
|
|
|
|
|
|
|
$context, |
51
|
|
|
|
|
|
|
sprintf( |
52
|
|
|
|
|
|
|
"Couldn't find included template %s in directories %s" |
53
|
|
|
|
|
|
|
, $template_name // 'undef' |
54
|
20
|
50
|
0
|
|
|
37
|
, join(', ', @{$self->{'dirs'}}) |
|
0
|
|
|
|
|
0
|
|
55
|
|
|
|
|
|
|
) |
56
|
|
|
|
|
|
|
) if not defined $result; |
57
|
|
|
|
|
|
|
|
58
|
20
|
|
|
|
|
85
|
return $result->render($context); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |