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