line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Tag::Widthratio; |
2
|
2
|
|
|
2
|
|
913
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
2
|
|
|
2
|
|
2
|
|
|
2
|
|
|
2
|
|
53
|
|
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
51
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
79
|
|
3
|
2
|
|
|
2
|
|
8
|
use parent 'DTL::Fast::Tag::Simple'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
14
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::TAG_HANDLERS{'widthratio'} = __PACKAGE__; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
113
|
use DTL::Fast::Utils; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
578
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#@Override |
10
|
|
|
|
|
|
|
sub parse_parameters |
11
|
|
|
|
|
|
|
{ |
12
|
3
|
|
|
3
|
0
|
2
|
my $self = shift; |
13
|
|
|
|
|
|
|
|
14
|
3
|
50
|
|
|
|
22
|
if( $self->{'parameter'} =~ /^\s*(.+?)(?:\s+as\s+([^\s]+))?\s*$/s ) |
15
|
|
|
|
|
|
|
{ |
16
|
3
|
|
|
|
|
7
|
$self->{'target_name'} = $2; |
17
|
|
|
|
|
|
|
|
18
|
3
|
|
|
|
|
10
|
$self->{'sources'} = $self->parse_sources($1); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
die $self->get_parse_error( |
21
|
|
|
|
|
|
|
sprintf( |
22
|
|
|
|
|
|
|
"Three arguments should be passed to widthratio: %s %s" |
23
|
|
|
|
|
|
|
, $self->{'parameter'} // 'undef' |
24
|
0
|
|
|
|
|
0
|
, scalar @{$self->{'sources'}} |
25
|
|
|
|
|
|
|
) |
26
|
3
|
50
|
0
|
|
|
2
|
) if scalar @{$self->{'sources'}} != 3; |
|
3
|
|
|
|
|
7
|
|
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
else |
29
|
|
|
|
|
|
|
{ |
30
|
0
|
|
|
|
|
0
|
die die $self->get_parse_error("Unable to parse ratio parameters $self->{'parameter'}"); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
3
|
|
|
|
|
4
|
return $self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#@Override |
37
|
|
|
|
|
|
|
sub render |
38
|
|
|
|
|
|
|
{ |
39
|
3
|
|
|
3
|
0
|
4
|
my $self = shift; |
40
|
3
|
|
|
|
|
2
|
my $context = shift; |
41
|
|
|
|
|
|
|
|
42
|
3
|
|
|
|
|
1
|
my $sources = $self->{'sources'}; |
43
|
3
|
|
|
|
|
8
|
my $result = int( |
44
|
|
|
|
|
|
|
$sources->[0]->render($context) |
45
|
|
|
|
|
|
|
/ $sources->[1]->render($context) |
46
|
|
|
|
|
|
|
* $sources->[2]->render($context) |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
3
|
100
|
|
|
|
5
|
if( $self->{'target_name'} ) |
50
|
|
|
|
|
|
|
{ |
51
|
1
|
|
|
|
|
5
|
$context->set($self->{'target_name'} => $result); |
52
|
1
|
|
|
|
|
1
|
$result = ''; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
3
|
|
|
|
|
9
|
return $result; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |