line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Tag::Include; |
2
|
5
|
|
|
5
|
|
3322
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
5
|
|
|
5
|
|
10
|
|
|
5
|
|
|
5
|
|
123
|
|
|
5
|
|
|
|
|
24
|
|
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
27
|
|
|
5
|
|
|
|
|
126
|
|
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
244
|
|
3
|
5
|
|
|
5
|
|
24
|
use parent 'DTL::Fast::Tag::Simple'; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
33
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::TAG_HANDLERS{'include'} = __PACKAGE__; |
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
313
|
use DTL::Fast::Expression; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
1763
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#@Override |
10
|
|
|
|
|
|
|
sub new |
11
|
|
|
|
|
|
|
{ |
12
|
17
|
|
|
17
|
0
|
65
|
my( $proto, $parameter, %kwargs ) = @_; |
13
|
17
|
|
50
|
|
|
46
|
$parameter //= ''; |
14
|
|
|
|
|
|
|
|
15
|
17
|
|
|
|
|
57
|
my @parameter = split /\s+with\s+/, $parameter; |
16
|
|
|
|
|
|
|
|
17
|
17
|
|
|
|
|
91
|
my $self = $proto->SUPER::new( $parameter[0], %kwargs ); |
18
|
|
|
|
|
|
|
|
19
|
17
|
100
|
|
|
|
60
|
if( scalar @parameter > 1 ) # with used |
20
|
|
|
|
|
|
|
{ |
21
|
1
|
|
|
|
|
3
|
$kwargs{'raw_chunks'} = []; |
22
|
1
|
|
|
|
|
628
|
require DTL::Fast::Tag::With; |
23
|
1
|
|
|
|
|
13
|
$self = DTL::Fast::Tag::With->new($parameter[1], %kwargs)->add_chunk($self); |
24
|
|
|
|
|
|
|
} |
25
|
17
|
|
|
|
|
65
|
return $self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#@Override |
30
|
|
|
|
|
|
|
sub parse_parameters |
31
|
|
|
|
|
|
|
{ |
32
|
17
|
|
|
17
|
0
|
28
|
my $self = shift; |
33
|
17
|
|
|
|
|
93
|
$self->{'template'} = DTL::Fast::Expression->new($self->{'parameter'}); |
34
|
17
|
|
|
|
|
38
|
return $self; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#@Override |
38
|
|
|
|
|
|
|
sub render |
39
|
|
|
|
|
|
|
{ |
40
|
21
|
|
|
21
|
0
|
32
|
my ($self, $context) = @_; |
41
|
|
|
|
|
|
|
|
42
|
21
|
|
|
|
|
89
|
my $template_name = $self->{'template'}->render($context); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $result = DTL::Fast::get_template( |
45
|
|
|
|
|
|
|
$template_name |
46
|
21
|
|
|
|
|
69
|
, '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
|
|
|
51
|
, join(', ', @{$self->{'dirs'}}) |
|
0
|
|
|
|
|
0
|
|
55
|
|
|
|
|
|
|
) |
56
|
|
|
|
|
|
|
) if not defined $result; |
57
|
|
|
|
|
|
|
|
58
|
20
|
|
|
|
|
109
|
return $result->render($context); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |