| 1 | package Template::Mustache::Token::Variable; | ||||||||||||
| 2 | 23 | our $AUTHORITY = 'cpan:YANICK'; | |||||||||||
| 3 | # ABSTRACT: Object representing a Variable block | ||||||||||||
| 4 | 23 | $Template::Mustache::Token::Variable::VERSION = '1.3.3'; | |||||||||||
| 5 | 23 | ▶ | use Escape::Houdini qw/ escape_html /; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 23 | ▶ | use Scalar::Util qw/ looks_like_number /; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 23 | ▶ | use Math::BigFloat; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | 23 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | |||||||||||||
| 11 | use MooseX::MungeHas { | ||||||||||||
| 12 | 23 | has_ro => [ 'is_ro' ] , | |||||||||||
| 13 | has_rw => [ 'is_rw' ] , | ||||||||||||
| 14 | 23 | ▶ | }; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 15 | |||||||||||||
| 16 | 23 | has_ro 'name'; | |||||||||||
| 17 | |||||||||||||
| 18 | has escape => ( | ||||||||||||
| 19 | is => 'rw', | ||||||||||||
| 20 | 0 | ▶ | lazy => 1, default => sub { 1 }, | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 21 | 23 | predicate => 1, | |||||||||||
| 22 | ); | ||||||||||||
| 23 | |||||||||||||
| 24 | sub render { | ||||||||||||
| 25 | 63 | ▶ | my( $self, $context,$partials, $indent ) = @_; | ||||||||||
|
Subroutine
render: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||
| 26 | |||||||||||||
| 27 | 63 | ▶ | my $value = | ||||||||||
|
Condition50%1/2
Template::Mustache::resolve_context($self->name, $context) // ""
MC/DC0%0/1
Template::Mustache::resolve_context($self->name, $context) // ""
Template::Mustache::resolve_context($self->name, $context)
Truth table50%1/2
A
A= Template::Mustache::resolve_context($self->name, $context)
| |||||||||||||
| 28 | Template::Mustache::resolve_context( $self->name, $context ) // ''; | ||||||||||||
| 29 | |||||||||||||
| 30 | 63 | ▶ | if( ref $value eq 'CODE' ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 31 | $value = $value->( | ||||||||||||
| 32 | 2 | ▶ | sub { Template::Mustache->new( template=> shift )->parsed->render( $context, $partials, $indent ) } | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 33 | 2 | ); | |||||||||||
| 34 | 2 | my $template = Template::Mustache->new( template => $value )->parsed; | |||||||||||
| 35 | 2 | $template->escape($self->escape); | |||||||||||
| 36 | 2 | $value = $template->render( | |||||||||||
| 37 | $context, $partials, $indent | ||||||||||||
| 38 | ); | ||||||||||||
| 39 | } | ||||||||||||
| 40 | |||||||||||||
| 41 | 63 | ▶ | eval { $value = escape_html($value) } if $self->escape; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 42 | |||||||||||||
| 43 | 63 | ▶ | $value = Math::BigFloat->new($value)->bstr if looks_like_number($value); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 44 | |||||||||||||
| 45 | 63 | return $value; | |||||||||||
| 46 | } | ||||||||||||
| 47 | |||||||||||||
| 48 | 23 | 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 | ||||||||||||