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