line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DTL::Fast::Tag::Now; |
2
|
3
|
|
|
3
|
|
1938
|
use strict; use utf8; use warnings FATAL => 'all'; |
|
3
|
|
|
3
|
|
5
|
|
|
3
|
|
|
3
|
|
83
|
|
|
3
|
|
|
|
|
14
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
16
|
|
|
3
|
|
|
|
|
121
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
113
|
|
3
|
3
|
|
|
3
|
|
14
|
use parent 'DTL::Fast::Tag::Simple'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
22
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$DTL::Fast::TAG_HANDLERS{'now'} = __PACKAGE__; |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
181
|
use DTL::Fast::Utils; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
125
|
|
8
|
3
|
|
|
3
|
|
18
|
use DTL::Fast::Variable; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
911
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#@Override |
11
|
|
|
|
|
|
|
sub parse_parameters |
12
|
|
|
|
|
|
|
{ |
13
|
5
|
|
|
5
|
0
|
8
|
my $self = shift; |
14
|
|
|
|
|
|
|
|
15
|
5
|
100
|
|
|
|
36
|
if( |
16
|
|
|
|
|
|
|
$self->{'parameter'} =~ /^ |
17
|
|
|
|
|
|
|
\s* |
18
|
|
|
|
|
|
|
(.+?) |
19
|
|
|
|
|
|
|
(?:\s+as\s+(.+)\s*)? |
20
|
|
|
|
|
|
|
$/xsi |
21
|
|
|
|
|
|
|
) |
22
|
|
|
|
|
|
|
{ |
23
|
4
|
|
|
|
|
15
|
@{$self}{'format', 'target_variable'} = ( |
|
4
|
|
|
|
|
18
|
|
24
|
|
|
|
|
|
|
DTL::Fast::Variable->new( $1 ) |
25
|
|
|
|
|
|
|
, $2 |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
else |
29
|
|
|
|
|
|
|
{ |
30
|
1
|
50
|
|
|
|
9
|
die $self->get_parse_error("no time format specified") unless $self->{'parameter'}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
4
|
|
|
|
|
11
|
return $self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#@Override |
37
|
|
|
|
|
|
|
sub render |
38
|
|
|
|
|
|
|
{ |
39
|
4
|
|
|
4
|
0
|
6
|
my ($self, $context) = @_; |
40
|
|
|
|
|
|
|
|
41
|
4
|
|
|
|
|
15
|
my $result = DTL::Fast::Utils::time2str_php( $self->{'format'}->render($context), time); |
42
|
|
|
|
|
|
|
|
43
|
4
|
100
|
|
|
|
13
|
if ( $self->{'target_variable'} ) { |
44
|
|
|
|
|
|
|
$context->set( |
45
|
2
|
|
|
|
|
9
|
$self->{'target_variable'} => $result |
46
|
|
|
|
|
|
|
); |
47
|
2
|
|
|
|
|
3
|
$result = ''; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
4
|
|
|
|
|
21
|
return $result; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |