line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Tag::With; |
2
|
4
|
|
|
4
|
|
1981
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
4
|
|
|
4
|
|
7
|
|
|
4
|
|
|
4
|
|
101
|
|
|
4
|
|
|
|
|
21
|
|
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
107
|
|
|
4
|
|
|
|
|
107
|
|
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
142
|
|
3
|
4
|
|
|
4
|
|
21
|
use parent 'DTL::Fast::Tag'; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
23
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::TAG_HANDLERS{'with'} = __PACKAGE__; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#@Override |
8
|
35
|
|
|
35
|
0
|
170
|
sub get_close_tag{return 'endwith';} |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#@Override |
11
|
|
|
|
|
|
|
sub parse_parameters |
12
|
|
|
|
|
|
|
{ |
13
|
23
|
|
|
23
|
0
|
40
|
my $self = shift; |
14
|
|
|
|
|
|
|
|
15
|
23
|
|
|
|
|
48
|
$self->{'mappings'} = {}; |
16
|
23
|
100
|
|
|
|
88
|
if( $self->{'parameter'} =~ /^\s*(.+?)\s+as\s+(.+)\s*$/s ) # legacy |
17
|
|
|
|
|
|
|
{ |
18
|
1
|
|
|
|
|
10
|
$self->{'mappings'}->{$2} = DTL::Fast::Expression->new($1); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
else # modern |
21
|
|
|
|
|
|
|
{ |
22
|
22
|
|
|
|
|
37
|
my @parts = (); |
23
|
22
|
|
|
|
|
88
|
my $string = $self->backup_strings($self->{'parameter'}); |
24
|
|
|
|
|
|
|
|
25
|
22
|
|
|
|
|
144
|
while ( $string =~ s{^ |
26
|
|
|
|
|
|
|
\s* |
27
|
|
|
|
|
|
|
([^\s\=]+) |
28
|
|
|
|
|
|
|
\s*\=\s* |
29
|
|
|
|
|
|
|
([^\s\=]+) |
30
|
|
|
|
|
|
|
\s* |
31
|
|
|
|
|
|
|
}{}x |
32
|
|
|
|
|
|
|
) |
33
|
|
|
|
|
|
|
{ |
34
|
36
|
|
|
|
|
126
|
$self->{'mappings'}->{$1} = $self->get_backup_or_variable($2); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
21
|
100
|
|
|
|
63
|
if ( $string ) { |
38
|
|
|
|
|
|
|
die $self->get_parse_error( |
39
|
|
|
|
|
|
|
"there is an error in `with` parameters" |
40
|
2
|
|
|
|
|
18
|
, 'Passed parameters' => $self->{'parameter'} |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
20
|
|
|
|
|
45
|
return $self; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
#@Override |
49
|
|
|
|
|
|
|
sub render |
50
|
|
|
|
|
|
|
{ |
51
|
14
|
|
|
14
|
0
|
21
|
my $self = shift; |
52
|
14
|
|
|
|
|
21
|
my $context = shift; |
53
|
|
|
|
|
|
|
|
54
|
14
|
|
|
|
|
23
|
my %vars = (); |
55
|
14
|
|
|
|
|
18
|
foreach my $key (keys(%{$self->{'mappings'}})) |
|
14
|
|
|
|
|
43
|
|
56
|
|
|
|
|
|
|
{ |
57
|
24
|
|
|
|
|
77
|
$vars{$key} = $self->{'mappings'}->{$key}->render($context); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
14
|
|
|
|
|
45
|
$context->push_scope()->set(%vars); |
61
|
|
|
|
|
|
|
|
62
|
14
|
|
|
|
|
54
|
my $result = $self->SUPER::render($context); |
63
|
|
|
|
|
|
|
|
64
|
10
|
|
|
|
|
30
|
$context->pop_scope(); |
65
|
|
|
|
|
|
|
|
66
|
10
|
|
|
|
|
50
|
return $result; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |