line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Filter::Time; |
2
|
2
|
|
|
2
|
|
734
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
2
|
|
|
2
|
|
3
|
|
|
2
|
|
|
2
|
|
41
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
34
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
57
|
|
3
|
2
|
|
|
2
|
|
6
|
use parent 'DTL::Fast::Filter'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
9
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::FILTER_HANDLERS{'time'} = __PACKAGE__; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
97
|
use DTL::Fast::Utils; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
279
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#@Override |
10
|
|
|
|
|
|
|
#@todo make pre-defined formats from Django |
11
|
|
|
|
|
|
|
sub parse_parameters |
12
|
|
|
|
|
|
|
{ |
13
|
2
|
|
|
2
|
0
|
2
|
my $self = shift; |
14
|
0
|
|
|
|
|
0
|
push @{$self->{'parameter'}}, DTL::Fast::Variable->new('"TIME_FORMAT"') |
15
|
2
|
50
|
|
|
|
2
|
if not scalar @{$self->{'parameter'}}; |
|
2
|
|
|
|
|
4
|
|
16
|
2
|
|
|
|
|
3
|
$self->{'format'} = $self->{'parameter'}->[0]; |
17
|
2
|
|
|
|
|
5
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#@Override |
21
|
|
|
|
|
|
|
sub filter |
22
|
|
|
|
|
|
|
{ |
23
|
2
|
|
|
2
|
0
|
2
|
my $self = shift; # self |
24
|
2
|
|
|
|
|
2
|
shift; # filter_manager |
25
|
2
|
|
|
|
|
1
|
my $value = shift; |
26
|
2
|
|
|
|
|
2
|
my $context = shift; |
27
|
|
|
|
|
|
|
|
28
|
2
|
|
|
|
|
6
|
my $format = $self->{'format'}->render($context); |
29
|
|
|
|
|
|
|
|
30
|
2
|
|
|
|
|
4
|
return DTL::Fast::Utils::time2str($format, $value); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |