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