line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Mustache::Token::Variable; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Object representing a Variable block |
4
|
|
|
|
|
|
|
$Template::Mustache::Token::Variable::VERSION = '1.3.4'; |
5
|
20
|
|
|
20
|
|
7596
|
use Escape::Houdini qw/ escape_html /; |
|
20
|
|
|
|
|
22695
|
|
|
20
|
|
|
|
|
1273
|
|
6
|
20
|
|
|
20
|
|
133
|
use Scalar::Util qw/ looks_like_number /; |
|
20
|
|
|
|
|
52
|
|
|
20
|
|
|
|
|
777
|
|
7
|
20
|
|
|
20
|
|
18013
|
use Math::BigFloat; |
|
20
|
|
|
|
|
930717
|
|
|
20
|
|
|
|
|
121
|
|
8
|
|
|
|
|
|
|
|
9
|
20
|
|
|
20
|
|
406541
|
use Moo; |
|
20
|
|
|
|
|
50
|
|
|
20
|
|
|
|
|
193
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use MooseX::MungeHas { |
12
|
20
|
|
|
|
|
226
|
has_ro => [ 'is_ro' ] , |
13
|
|
|
|
|
|
|
has_rw => [ 'is_rw' ] , |
14
|
20
|
|
|
20
|
|
8806
|
}; |
|
20
|
|
|
|
|
47
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has_ro 'name'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has escape => ( |
19
|
|
|
|
|
|
|
is => 'rw', |
20
|
|
|
|
|
|
|
lazy => 1, default => sub { 1 }, |
21
|
|
|
|
|
|
|
predicate => 1, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub render { |
25
|
62
|
|
|
62
|
0
|
150
|
my( $self, $context,$partials, $indent ) = @_; |
26
|
|
|
|
|
|
|
|
27
|
62
|
|
50
|
|
|
280
|
my $value = |
28
|
|
|
|
|
|
|
Template::Mustache::resolve_context( $self->name, $context ) // ''; |
29
|
|
|
|
|
|
|
|
30
|
62
|
100
|
|
|
|
187
|
if( ref $value eq 'CODE' ) { |
31
|
|
|
|
|
|
|
$value = $value->( |
32
|
2
|
|
|
2
|
|
47
|
sub { Template::Mustache->new( template=> shift )->parsed->render( $context, $partials, $indent ) } |
33
|
2
|
|
|
|
|
13
|
); |
34
|
2
|
|
|
|
|
382
|
my $template = Template::Mustache->new( template => $value )->parsed; |
35
|
2
|
|
|
|
|
62
|
$template->escape($self->escape); |
36
|
2
|
|
|
|
|
459
|
$value = $template->render( |
37
|
|
|
|
|
|
|
$context, $partials, $indent |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
62
|
50
|
|
|
|
1040
|
eval { $value = escape_html($value) } if $self->escape; |
|
62
|
|
|
|
|
593
|
|
42
|
|
|
|
|
|
|
|
43
|
62
|
100
|
|
|
|
288
|
$value = Math::BigFloat->new($value)->bstr if looks_like_number($value); |
44
|
|
|
|
|
|
|
|
45
|
62
|
|
|
|
|
1435
|
return $value; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=pod |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=encoding UTF-8 |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 NAME |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Template::Mustache::Token::Variable - Object representing a Variable block |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 VERSION |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
version 1.3.4 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 AUTHORS |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=over 4 |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item * |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Pieter van de Bruggen <pvande@cpan.org> |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item * |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Yanick Champoux <yanick@cpan.org> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item * |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Ricardo Signes <rjbs@cpan.org> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=back |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This software is copyright (c) 2021, 2019, 2018, 2017, 2016, 2015, 2011 by Pieter van de Bruggen. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
87
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |