| 1 | package DTL::Fast::Tag::Now; | ||||||||||
| 2 | 3 | ▶ | 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 | 3 | ▶ | use parent 'DTL::Fast::Tag::Simple'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 3 | $DTL::Fast::TAG_HANDLERS{'now'} = __PACKAGE__; | |||||||||
| 6 | |||||||||||
| 7 | 3 | ▶ | use DTL::Fast::Utils; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 3 | ▶ | use DTL::Fast::Variable; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | #@Override | ||||||||||
| 11 | sub parse_parameters | ||||||||||
| 12 | { | ||||||||||
| 13 | 5 | ▶ | my $self = shift; | ||||||||
|
Subroutine
parse_parameters: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 14 | |||||||||||
| 15 | 5 | ▶ | if( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | $self->{'parameter'} =~ /^ | ||||||||||
| 17 | \s* | ||||||||||
| 18 | (.+?) | ||||||||||
| 19 | (?:\s+as\s+(.+)\s*)? | ||||||||||
| 20 | $/xsi | ||||||||||
| 21 | ) | ||||||||||
| 22 | { | ||||||||||
| 23 | 4 | @{$self}{'format', 'target_variable'} = ( | |||||||||
| 24 | DTL::Fast::Variable->new( $1 ) | ||||||||||
| 25 | , $2 | ||||||||||
| 26 | ); | ||||||||||
| 27 | } | ||||||||||
| 28 | else | ||||||||||
| 29 | { | ||||||||||
| 30 | 1 | ▶ | die $self->get_parse_error("no time format specified") unless $self->{'parameter'}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 4 | return $self; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | #@Override | ||||||||||
| 37 | sub render | ||||||||||
| 38 | { | ||||||||||
| 39 | 4 | ▶ | my ($self, $context) = @_; | ||||||||
|
Subroutine
render: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 40 | |||||||||||
| 41 | 4 | my $result = DTL::Fast::Utils::time2str_php( $self->{'format'}->render($context), time); | |||||||||
| 42 | |||||||||||
| 43 | 4 | ▶ | if ( $self->{'target_variable'} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | $context->set( | ||||||||||
| 45 | 2 | $self->{'target_variable'} => $result | |||||||||
| 46 | ); | ||||||||||
| 47 | 2 | $result = ''; | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 4 | return $result; | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | |||||||||||
| 54 | 3 | 1; | |||||||||