| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
23332
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
42
|
|
|
2
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
56
|
|
|
3
|
|
|
|
|
|
|
package Dancer::Template::Tiny; |
|
4
|
|
|
|
|
|
|
BEGIN { |
|
5
|
1
|
|
|
1
|
|
16
|
$Dancer::Template::Tiny::VERSION = '0.03'; |
|
6
|
|
|
|
|
|
|
} |
|
7
|
|
|
|
|
|
|
# ABSTRACT: Template::Tiny backend to Dancer |
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
824
|
use Template::Tiny; |
|
|
1
|
|
|
|
|
1574
|
|
|
|
1
|
|
|
|
|
37
|
|
|
10
|
1
|
|
|
1
|
|
835
|
use Dancer::FileUtils 'read_file_content'; |
|
|
1
|
|
|
|
|
37451
|
|
|
|
1
|
|
|
|
|
121
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
8
|
use base 'Dancer::Template::Abstract'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
901
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $_template = Template::Tiny->new; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub render($$$) { |
|
17
|
2
|
|
|
2
|
1
|
877
|
my ( $self, $template, $tokens ) = @_; |
|
18
|
|
|
|
|
|
|
|
|
19
|
2
|
50
|
33
|
|
|
8
|
( ref $template || -f $template ) |
|
20
|
|
|
|
|
|
|
or die "$template is not a regular file or reference"; |
|
21
|
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
3
|
my $template_data = ref $template ? |
|
23
|
2
|
50
|
|
|
|
7
|
${$template} : |
|
24
|
|
|
|
|
|
|
read_file_content($template); |
|
25
|
|
|
|
|
|
|
|
|
26
|
2
|
|
|
|
|
4
|
my $content; |
|
27
|
|
|
|
|
|
|
|
|
28
|
2
|
50
|
|
|
|
9
|
$_template->process( |
|
29
|
|
|
|
|
|
|
\$template_data, |
|
30
|
|
|
|
|
|
|
$tokens, |
|
31
|
|
|
|
|
|
|
\$content, |
|
32
|
|
|
|
|
|
|
) or die "Could not process template file '$template'"; |
|
33
|
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
597
|
return $content; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=pod |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 NAME |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Dancer::Template::Tiny - Template::Tiny backend to Dancer |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 VERSION |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
version 0.03 |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This template engine allows you to use L in L. |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
L is an implementation of a subset of L (the |
|
56
|
|
|
|
|
|
|
major parts) which takes much less memory and is faster. If you're only using |
|
57
|
|
|
|
|
|
|
the main functions of Template::Toolkit, you could use Template::Tiny. You can |
|
58
|
|
|
|
|
|
|
also seemlessly move back to Template::Toolkit whenver you want. |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
You can read more on L. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
To use this engine, all you need to configure in your L's |
|
63
|
|
|
|
|
|
|
C: |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
template: "tiny" |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Of course, you can also set this B working using C: |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# code code code |
|
70
|
|
|
|
|
|
|
set template => 'tiny'; |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Since L has internal support for a wrapper-like option with the |
|
73
|
|
|
|
|
|
|
C configuration option, you have a WRAPPER like with |
|
74
|
|
|
|
|
|
|
L even though L doesn't really support it. :) |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 render |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Renders the template. Accepts a string to a file or a reference to a string of |
|
81
|
|
|
|
|
|
|
the template. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 AUTHOR |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Sawyer X, C<< >> |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 BUGS |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
|
90
|
|
|
|
|
|
|
C, or through the web interface at |
|
91
|
|
|
|
|
|
|
L. |
|
92
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
|
93
|
|
|
|
|
|
|
your bug as I make changes. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 SUPPORT |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
perldoc Dancer::Template::Tiny |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
You can also look for information at: |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=over 4 |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
L |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
L |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
L |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item * Search CPAN |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
L |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=back |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
L |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Copyright 2010 Sawyer X. |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
132
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
|
133
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 AUTHOR |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Sawyer X |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
This software is copyright (c) 2010 by Sawyer X. |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
146
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=cut |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
__END__ |