line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
2860
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
89
|
|
2
|
2
|
|
|
2
|
|
14
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
130
|
|
3
|
|
|
|
|
|
|
package MojoX::Renderer::Alloy::HTE; |
4
|
|
|
|
|
|
|
BEGIN { |
5
|
2
|
|
|
2
|
|
69
|
$MojoX::Renderer::Alloy::HTE::AUTHORITY = 'cpan:AJGB'; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
{ |
8
|
|
|
|
|
|
|
$MojoX::Renderer::Alloy::HTE::VERSION = '1.121150'; |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
#ABSTRACT: Template::Alloy's HTML::Template::Expr renderer |
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
12
|
use base 'MojoX::Renderer::Alloy'; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
740
|
|
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
2
|
|
958
|
use Template::Alloy qw( HTE ); |
|
2
|
|
|
|
|
36785
|
|
|
2
|
|
|
|
|
24
|
|
15
|
2
|
|
|
2
|
|
21521
|
use File::Spec (); |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
957
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
__PACKAGE__->attr('_hte_config'); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _init { |
21
|
2
|
|
|
2
|
|
4
|
my $self = shift; |
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
|
|
18
|
my %config = $self->_default_config(@_); |
24
|
|
|
|
|
|
|
|
25
|
2
|
50
|
|
|
|
14
|
$config{path} = $config{INCLUDE_PATH} |
26
|
|
|
|
|
|
|
unless exists $config{path}; |
27
|
|
|
|
|
|
|
|
28
|
2
|
|
|
|
|
58
|
$self->_hte_config( \%config ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _render { |
32
|
22
|
|
|
22
|
|
62
|
my ($self, $r, $c, $output, $options) = @_; |
33
|
|
|
|
|
|
|
|
34
|
22
|
|
|
|
|
54
|
my $inline = $options->{inline}; |
35
|
|
|
|
|
|
|
|
36
|
22
|
|
|
|
|
73
|
my $tname = $r->template_name($options); |
37
|
22
|
|
|
|
|
357
|
my $path = $r->template_path($options); |
38
|
|
|
|
|
|
|
|
39
|
22
|
100
|
66
|
|
|
2354
|
return unless defined $inline || ( defined $path && defined $tname ); |
|
|
|
33
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
9
|
|
|
|
|
81
|
my $alloy; |
43
|
|
|
|
|
|
|
# inline |
44
|
9
|
50
|
|
|
|
235
|
if ( defined $inline ) { |
|
|
50
|
|
|
|
|
|
45
|
0
|
|
|
|
|
0
|
$alloy = Template::Alloy->new( |
46
|
|
|
|
|
|
|
type => 'scalarref', |
47
|
|
|
|
|
|
|
source => \$inline, |
48
|
0
|
|
|
|
|
0
|
%{ $self->_hte_config }, |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
# regular file |
52
|
|
|
|
|
|
|
elsif ( -r $path ) { |
53
|
9
|
|
|
|
|
243
|
$alloy = Template::Alloy->new( |
54
|
|
|
|
|
|
|
type => 'filename', |
55
|
|
|
|
|
|
|
source => $path, |
56
|
9
|
|
|
|
|
54
|
%{ $self->_hte_config }, |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
else { |
60
|
|
|
|
|
|
|
# inlined templates are not supported |
61
|
0
|
0
|
|
|
|
0
|
if ( $r->get_data_template($options, $tname) ) { |
62
|
0
|
|
|
|
|
0
|
$c->render_exception( |
63
|
|
|
|
|
|
|
"Inlined templates are not supported" |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
} else { |
66
|
0
|
|
|
|
|
0
|
$c->render_not_found( $tname ); |
67
|
|
|
|
|
|
|
}; |
68
|
0
|
|
|
|
|
0
|
return; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
9
|
|
|
|
|
1152
|
$alloy->param( |
72
|
|
|
|
|
|
|
$self->_template_vars( $c ) |
73
|
|
|
|
|
|
|
); |
74
|
|
|
|
|
|
|
|
75
|
9
|
|
|
|
|
600
|
eval { |
76
|
9
|
|
|
|
|
45
|
$$output = $alloy->output(); |
77
|
|
|
|
|
|
|
}; |
78
|
9
|
100
|
66
|
|
|
73087
|
if ( my $e = $alloy->error || $@ ) { |
79
|
2
|
|
|
|
|
41
|
chomp $e; |
80
|
2
|
|
|
|
|
229
|
$c->render_exception( $e ); |
81
|
|
|
|
|
|
|
|
82
|
2
|
|
|
|
|
126119
|
return; |
83
|
|
|
|
|
|
|
}; |
84
|
|
|
|
|
|
|
|
85
|
7
|
|
|
|
|
152
|
return 1; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
__END__ |