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.3'; |
5
|
20
|
|
|
20
|
|
8941
|
use Escape::Houdini qw/ escape_html /; |
|
20
|
|
|
|
|
24588
|
|
|
20
|
|
|
|
|
1302
|
|
6
|
20
|
|
|
20
|
|
141
|
use Scalar::Util qw/ looks_like_number /; |
|
20
|
|
|
|
|
57
|
|
|
20
|
|
|
|
|
920
|
|
7
|
20
|
|
|
20
|
|
20372
|
use Math::BigFloat; |
|
20
|
|
|
|
|
1027127
|
|
|
20
|
|
|
|
|
117
|
|
8
|
|
|
|
|
|
|
|
9
|
20
|
|
|
20
|
|
452985
|
use Moo; |
|
20
|
|
|
|
|
56
|
|
|
20
|
|
|
|
|
180
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use MooseX::MungeHas { |
12
|
20
|
|
|
|
|
258
|
has_ro => [ 'is_ro' ] , |
13
|
|
|
|
|
|
|
has_rw => [ 'is_rw' ] , |
14
|
20
|
|
|
20
|
|
10046
|
}; |
|
20
|
|
|
|
|
57
|
|
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
|
163
|
my( $self, $context,$partials, $indent ) = @_; |
26
|
|
|
|
|
|
|
|
27
|
62
|
|
50
|
|
|
299
|
my $value = |
28
|
|
|
|
|
|
|
Template::Mustache::resolve_context( $self->name, $context ) // ''; |
29
|
|
|
|
|
|
|
|
30
|
62
|
100
|
|
|
|
199
|
if( ref $value eq 'CODE' ) { |
31
|
|
|
|
|
|
|
$value = $value->( |
32
|
2
|
|
|
2
|
|
48
|
sub { Template::Mustache->new( template=> shift )->parsed->render( $context, $partials, $indent ) } |
33
|
2
|
|
|
|
|
13
|
); |
34
|
2
|
|
|
|
|
274
|
my $template = Template::Mustache->new( template => $value )->parsed; |
35
|
2
|
|
|
|
|
39
|
$template->escape($self->escape); |
36
|
2
|
|
|
|
|
295
|
$value = $template->render( |
37
|
|
|
|
|
|
|
$context, $partials, $indent |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
62
|
50
|
|
|
|
1263
|
eval { $value = escape_html($value) } if $self->escape; |
|
62
|
|
|
|
|
709
|
|
42
|
|
|
|
|
|
|
|
43
|
62
|
100
|
|
|
|
335
|
$value = Math::BigFloat->new($value)->bstr if looks_like_number($value); |
44
|
|
|
|
|
|
|
|
45
|
62
|
|
|
|
|
1561
|
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.3 |
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) 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 |