line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dancer::Template::Caml; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1788
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
80
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
79
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Carp; |
7
|
2
|
|
|
2
|
|
29
|
use File::Spec; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
74
|
|
8
|
2
|
|
|
2
|
|
1648
|
use Text::Caml; |
|
2
|
|
|
|
|
6259
|
|
|
2
|
|
|
|
|
63
|
|
9
|
2
|
|
|
2
|
|
911
|
use Dancer::Config 'setting'; |
|
2
|
|
|
|
|
90850
|
|
|
2
|
|
|
|
|
150
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
14
|
use base 'Dancer::Template::Abstract'; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
680
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $_engine; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
1
|
5026
|
sub default_tmpl_ext {"caml"} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub init { |
20
|
2
|
|
|
2
|
1
|
849
|
my $self = shift; |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
52
|
$_engine = |
23
|
2
|
|
|
|
|
14
|
Text::Caml->new(templates_path => setting('views'), %{$self->config}); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub render { |
27
|
2
|
|
|
2
|
1
|
221
|
my ($self, $template, $tokens) = @_; |
28
|
|
|
|
|
|
|
|
29
|
2
|
50
|
|
|
|
12
|
if (!ref $template) { |
30
|
2
|
50
|
|
|
|
48
|
-f $template |
31
|
|
|
|
|
|
|
or Carp::croak("'$template' doesn't exist or not a regular file"); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
2
|
50
|
|
|
|
22
|
unless (File::Spec->file_name_is_absolute($template)) { |
35
|
2
|
|
|
|
|
10
|
$template = File::Spec->abs2rel($template, $_engine->templates_path); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
2
|
|
|
|
|
227
|
return $_engine->render_file($template, $tokens); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 DESCRIPTION |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
This class is an interface between Dancer's template engine abstraction layer |
46
|
|
|
|
|
|
|
and the L module. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
In order to use this engine, use the template setting: |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
template: caml |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 METHODS |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 C |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$engine->render; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Render template. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 C |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Default template extention is C. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 C |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
$engine->init; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Initialize engine (done by L). |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 SEE ALSO |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
L, L |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 DEVELOPMENT |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 Repository |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
http://github.com/vti/dancer-template-caml |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 AUTHOR |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Viacheslav Tykhanovskyi, C. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Copyright (C) 2011-2012, Viacheslav Tykhanovskyi |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under |
89
|
|
|
|
|
|
|
the terms of the Artistic License version 2.0. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |