| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Mustache::Simple::ContextStack; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
16
|
use strict; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
66
|
|
|
4
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
77
|
|
|
5
|
3
|
|
|
3
|
|
25
|
use 5.10.1; |
|
|
3
|
|
|
|
|
50
|
|
|
6
|
3
|
|
|
3
|
|
13
|
use version; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = version->declare('v1.3.6'); |
|
9
|
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
216
|
use Scalar::Util qw(blessed reftype); |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
143
|
|
|
11
|
3
|
|
|
3
|
|
15
|
use Carp; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
798
|
|
|
12
|
|
|
|
|
|
|
our @CARP_NOT = qw(Mustache::Simple); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Don't forget to change the version in the pod |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#use Data::Dumper; |
|
17
|
|
|
|
|
|
|
#$Data::Dumper::Useqq = 1; |
|
18
|
|
|
|
|
|
|
#$Data::Dumper::Deparse = 1; |
|
19
|
|
|
|
|
|
|
# |
|
20
|
|
|
|
|
|
|
#use Data::Dump qw(dumpf); |
|
21
|
|
|
|
|
|
|
# |
|
22
|
|
|
|
|
|
|
#sub debug($) |
|
23
|
|
|
|
|
|
|
#{ |
|
24
|
|
|
|
|
|
|
# say dumpf(shift, sub { |
|
25
|
|
|
|
|
|
|
# my ($ctx, $ref) = @_; |
|
26
|
|
|
|
|
|
|
# return { dump => qq(<$ref>) } if $ctx->object_isa('DateTime'); |
|
27
|
|
|
|
|
|
|
# } |
|
28
|
|
|
|
|
|
|
# ); |
|
29
|
|
|
|
|
|
|
# say "-" x 50; |
|
30
|
|
|
|
|
|
|
#} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub new |
|
33
|
|
|
|
|
|
|
{ |
|
34
|
98
|
|
|
98
|
0
|
161
|
my $class = shift; |
|
35
|
98
|
|
|
|
|
152
|
my $self = []; |
|
36
|
98
|
|
|
|
|
431
|
bless $self, $class; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub push |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
222
|
|
|
222
|
0
|
318
|
my $self = shift; |
|
42
|
222
|
|
|
|
|
272
|
my $context = shift; |
|
43
|
222
|
|
|
|
|
483
|
push @$self, $context; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub pop |
|
47
|
|
|
|
|
|
|
{ |
|
48
|
222
|
|
|
222
|
0
|
271
|
my $self = shift; |
|
49
|
222
|
|
|
|
|
288
|
my $context = pop @$self; |
|
50
|
222
|
|
|
|
|
380
|
return $context; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub search |
|
54
|
|
|
|
|
|
|
{ |
|
55
|
186
|
|
|
186
|
0
|
221
|
my $self = shift; |
|
56
|
186
|
|
|
|
|
239
|
my $element = shift; |
|
57
|
186
|
|
|
|
|
386
|
for (my $i = $#$self; $i >= 0; $i--) |
|
58
|
|
|
|
|
|
|
{ |
|
59
|
302
|
|
|
|
|
420
|
my $context = $self->[$i]; |
|
60
|
302
|
50
|
|
|
|
593
|
if (blessed $context) |
|
61
|
|
|
|
|
|
|
{ |
|
62
|
0
|
0
|
|
|
|
0
|
if ($context->can($element)) { |
|
63
|
0
|
|
|
|
|
0
|
my @ret = $context->$element(); # array context |
|
64
|
0
|
0
|
|
|
|
0
|
return @ret if wantarray(); |
|
65
|
0
|
|
|
|
|
0
|
return $ret[0]; # first elt will be answer if non-array context |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
} |
|
68
|
302
|
50
|
|
|
|
621
|
next unless reftype $context eq 'HASH'; |
|
69
|
|
|
|
|
|
|
|
|
70
|
302
|
100
|
|
|
|
886
|
return $context->{$element} if exists $context->{$element}; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
5
|
|
|
|
|
15
|
return undef; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub top |
|
76
|
|
|
|
|
|
|
{ |
|
77
|
10
|
|
|
10
|
0
|
13
|
my $self = shift; |
|
78
|
10
|
|
|
|
|
21
|
return $self->[-1]; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |