line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::FormBuilder::Template::HTC; |
2
|
|
|
|
|
|
|
$VERSION = '0.02'; |
3
|
1
|
|
|
1
|
|
90806
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
46
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
1325
|
use Data::Dumper; |
|
1
|
|
|
|
|
10286
|
|
|
1
|
|
|
|
|
93
|
|
6
|
1
|
|
|
1
|
|
12
|
use Carp qw(croak carp); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
63
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
6
|
use CGI::FormBuilder::Util; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
202
|
|
10
|
1
|
|
|
1
|
|
1955
|
use HTML::Template::Compiled; |
|
1
|
|
|
|
|
85646
|
|
|
1
|
|
|
|
|
12
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
1
|
15
|
sub engine_class { 'HTML::Template::Compiled' } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
1
|
|
|
1
|
1
|
68106
|
my ($class, @opts) = @_; |
16
|
1
|
|
|
|
|
4
|
my $opt = arghash(@opts); |
17
|
1
|
|
|
|
|
7
|
bless $opt, $class; |
18
|
1
|
|
|
|
|
6
|
$opt->{engine} = $opt->engine_class()->new(%$opt); |
19
|
1
|
|
|
|
|
13701
|
return $opt; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub engine { |
23
|
0
|
|
|
0
|
1
|
0
|
return $_[0]->{engine}; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub render { |
27
|
1
|
|
|
1
|
1
|
49
|
my $self = shift; |
28
|
1
|
|
33
|
|
|
7
|
my $tvar = shift |
29
|
|
|
|
|
|
|
|| puke "Missing template expansion hashref (\$form->prepare failed?)"; |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
50
|
|
|
11
|
my $htc_data = $self->{data} || {}; |
32
|
1
|
|
|
|
|
4
|
my $htc_var = $self->{variable}; # optional var for nesting |
33
|
|
|
|
|
|
|
|
34
|
1
|
50
|
|
|
|
5
|
if ($htc_var) { |
35
|
1
|
|
|
|
|
346
|
$htc_data->{$htc_var} = $tvar; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
else { |
38
|
0
|
|
|
|
|
0
|
$htc_data = { %$htc_data, %$tvar }; |
39
|
|
|
|
|
|
|
} |
40
|
1
|
|
|
|
|
4
|
my $htc_output; # growing a scalar is so C-ish |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
12
|
$self->{engine}->param(%$htc_data); |
43
|
1
|
|
|
|
|
28
|
my $output = $self->{engine}->output(); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# string HTML output |
46
|
1
|
|
|
|
|
999
|
return $output; |
47
|
|
|
|
|
|
|
} ## end sub render |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |