line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Lazy::Template; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1481
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use HTML::Template; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
22
|
|
6
|
1
|
|
|
1
|
|
6
|
use CGI::Lazy::Globals; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
115
|
|
7
|
1
|
|
|
1
|
|
657
|
use CGI::Lazy::Template::Boilerplate; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
465
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------------- |
10
|
|
|
|
|
|
|
sub boilerplate { |
11
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
12
|
0
|
|
|
|
|
0
|
my $widget = shift; |
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
0
|
return CGI::Lazy::Template::Boilerplate->new($self, $widget); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------------- |
18
|
|
|
|
|
|
|
sub config { |
19
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
4
|
return $self->q->config; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------------- |
25
|
|
|
|
|
|
|
sub q { |
26
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
8
|
return $self->{_q}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------------- |
32
|
|
|
|
|
|
|
sub new { |
33
|
1
|
|
|
1
|
1
|
3
|
my $class = shift; |
34
|
1
|
|
|
|
|
2
|
my $q = shift; |
35
|
1
|
|
|
|
|
2
|
my $tmplname = shift; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
1
|
|
|
|
|
5
|
my $self = {_q => $q, _tmplname => $tmplname}; |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
3
|
bless $self, $class; |
41
|
|
|
|
|
|
|
|
42
|
1
|
50
|
33
|
|
|
5
|
if ($self->config->tmplDir && $tmplname) { |
43
|
0
|
|
|
|
|
0
|
eval { |
44
|
0
|
|
|
|
|
0
|
$self->{_template} = HTML::Template->new( |
45
|
|
|
|
|
|
|
filename => $self->config->tmplDir."/".$tmplname, |
46
|
|
|
|
|
|
|
die_on_bad_params => 0, |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
}; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
1
|
50
|
|
|
|
6
|
if ($@) { |
52
|
0
|
|
|
|
|
0
|
$self->q->errorHandler->tmplCreateError; |
53
|
0
|
|
|
|
|
0
|
exit; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
1
|
|
|
|
|
7
|
return $self; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------------- |
60
|
|
|
|
|
|
|
sub process { |
61
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
62
|
0
|
|
|
|
|
|
my $vars = shift; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
eval { |
65
|
0
|
|
|
|
|
|
$self->template->param($vars); |
66
|
|
|
|
|
|
|
}; |
67
|
|
|
|
|
|
|
|
68
|
0
|
0
|
|
|
|
|
if ($@) { |
69
|
0
|
|
|
|
|
|
$self->q->errorHandler->tmplParamError($self->tmplName); |
70
|
0
|
|
|
|
|
|
exit; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
my $output; |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
eval { |
76
|
0
|
|
|
|
|
|
$output = $self->template->output; |
77
|
|
|
|
|
|
|
}; |
78
|
|
|
|
|
|
|
|
79
|
0
|
0
|
|
|
|
|
if ($@) { |
80
|
0
|
|
|
|
|
|
$self->q->errorHandler->tmplParamError($self->tmplName); |
81
|
0
|
|
|
|
|
|
exit; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
return $output; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------------- |
88
|
|
|
|
|
|
|
sub template { |
89
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
return $self->{_template}; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------------- |
95
|
|
|
|
|
|
|
sub tmplName { |
96
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
return $self->{_tmplname}; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1 |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
__END__ |