| 1 | package DTL::Fast::Filter::Time; | ||||||||||
| 2 | 2 | ▶ | use strict; use utf8; use warnings FATAL => 'all'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 2 | ▶ | use parent 'DTL::Fast::Filter'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 2 | $DTL::Fast::FILTER_HANDLERS{'time'} = __PACKAGE__; | |||||||||
| 6 | |||||||||||
| 7 | 2 | ▶ | use DTL::Fast::Utils; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | #@Override | ||||||||||
| 10 | #@todo make pre-defined formats from Django | ||||||||||
| 11 | sub parse_parameters | ||||||||||
| 12 | { | ||||||||||
| 13 | 2 | ▶ | my $self = shift; | ||||||||
|
Subroutine
parse_parameters: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||
| 14 | 0 | push @{$self->{'parameter'}}, DTL::Fast::Variable->new('"TIME_FORMAT"') | |||||||||
| 15 | 2 | ▶ | if not scalar @{$self->{'parameter'}}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 2 | $self->{'format'} = $self->{'parameter'}->[0]; | |||||||||
| 17 | 2 | return $self; | |||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | #@Override | ||||||||||
| 21 | sub filter | ||||||||||
| 22 | { | ||||||||||
| 23 | 2 | ▶ | my $self = shift; # self | ||||||||
|
Subroutine
filter: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 24 | 2 | shift; # filter_manager | |||||||||
| 25 | 2 | my $value = shift; | |||||||||
| 26 | 2 | my $context = shift; | |||||||||
| 27 | |||||||||||
| 28 | 2 | my $format = $self->{'format'}->render($context); | |||||||||
| 29 | |||||||||||
| 30 | 2 | return DTL::Fast::Utils::time2str($format, $value); | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 2 | 1; | |||||||||