line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dancer2::Template::HTCompiled; |
2
|
2
|
|
|
2
|
|
27278
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
73
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
78
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.002_001'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
993
|
use Moo; |
|
2
|
|
|
|
|
24056
|
|
|
2
|
|
|
|
|
11
|
|
7
|
2
|
|
|
2
|
|
2595
|
use Carp qw/ croak /; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
113
|
|
8
|
2
|
|
|
2
|
|
1557
|
use HTML::Template::Compiled; |
|
2
|
|
|
|
|
94856
|
|
|
2
|
|
|
|
|
12
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'Dancer2::Core::Role::Template'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has '+default_tmpl_ext' => ( |
13
|
|
|
|
|
|
|
default => sub { 'html' } |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
has '+engine' => ( |
16
|
|
|
|
|
|
|
isa => sub { |
17
|
|
|
|
|
|
|
$_[0] eq "HTML::Template::Compiled" |
18
|
|
|
|
|
|
|
}, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _build_engine { |
22
|
1
|
|
|
1
|
|
486
|
'HTML::Template::Compiled' |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub render { |
26
|
4
|
|
|
4
|
1
|
1315
|
my ($self, $tmpl, $vars) = @_; |
27
|
|
|
|
|
|
|
|
28
|
4
|
|
|
|
|
7
|
my %config = %{ $self->config }; |
|
4
|
|
|
|
|
23
|
|
29
|
4
|
|
|
|
|
7
|
my $env = delete $config{environment}; |
30
|
4
|
|
|
|
|
5
|
my $location = delete $config{location}; |
31
|
4
|
50
|
|
|
|
49
|
$config{path} = File::Spec->catfile($location, $config{path}) |
32
|
|
|
|
|
|
|
if defined $location; |
33
|
4
|
|
|
|
|
68
|
my $htc = $self->engine; |
34
|
4
|
|
|
|
|
27
|
my $content = eval { |
35
|
4
|
|
|
|
|
5
|
my $t; |
36
|
4
|
100
|
|
|
|
9
|
if ( ref($tmpl) eq 'SCALAR' ) { |
37
|
2
|
|
|
|
|
9
|
$t = $htc->new_scalar_ref($tmpl, %config); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
else { |
40
|
2
|
|
|
|
|
18
|
$t = $htc->new_file($tmpl, %config); |
41
|
|
|
|
|
|
|
} |
42
|
3
|
|
|
|
|
4502
|
$t->param($vars); |
43
|
3
|
|
|
|
|
56
|
$t->output; |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
|
46
|
4
|
100
|
|
|
|
893
|
if (my $error = $@) { |
47
|
1
|
|
|
|
|
20
|
croak $error; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
3
|
|
|
|
|
12
|
return $content; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |