| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Template::Plugin::HTML::SuperForm; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
53356
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
54
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
565
|
use HTML::SuperForm; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use base 'Template::Plugin'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = 1.0; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
|
11
|
|
|
|
|
|
|
my $class = shift; |
|
12
|
|
|
|
|
|
|
my $context = shift; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $arg = shift; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
unless(defined($arg)) { |
|
17
|
|
|
|
|
|
|
for my $key (keys %{$context->{STASH}}) { |
|
18
|
|
|
|
|
|
|
my $value = $context->{STASH}{$key}; |
|
19
|
|
|
|
|
|
|
if(UNIVERSAL::isa($value, 'Apache') || |
|
20
|
|
|
|
|
|
|
UNIVERSAL::isa($value, 'CGI')) { |
|
21
|
|
|
|
|
|
|
$arg = $value; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
return HTML::SuperForm->new($arg, @_); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 NAME |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Template::Plugin::HTML::SuperForm - Template Plugin for HTML::SuperForm |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
[% USE form = HTML.SuperForm %] |
|
38
|
|
|
|
|
|
|
[% form.text(name => 'my_text', default => 'default text') %] |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
This is an interface into HTML::SuperForm through the Template Toolkit. |
|
43
|
|
|
|
|
|
|
When created without arguments (i.e. [% USE form = HTML.SuperForm %]), |
|
44
|
|
|
|
|
|
|
the Template's stash is searched for an Apache object or a CGI object |
|
45
|
|
|
|
|
|
|
to pass to HTML::SuperForm's constructor. |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
When created with arguments (i.e. [% USE form = HTML.SuperForm(arg) %]), |
|
48
|
|
|
|
|
|
|
the arguments are passed to HTML::SuperForm's constructor. |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 USES |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
With mod_perl: |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
myHandler.pm: |
|
56
|
|
|
|
|
|
|
package myHandler; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
use Apache::Constants qw(OK); |
|
59
|
|
|
|
|
|
|
use Template; |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub handler { |
|
62
|
|
|
|
|
|
|
my $r = shift; |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
my $tt = Template->new(); |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
$r->content_type('text/html'); |
|
67
|
|
|
|
|
|
|
$r->send_http_header(); |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
$tt->process('my_template.tt', { r => $r }); |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
return OK; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my_template.tt: |
|
75
|
|
|
|
|
|
|
[% USE form = HTML.SuperForm %] |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
[% form.start_form(name => 'my_form') %] |
|
79
|
|
|
|
|
|
|
[% form.text(name => 'my_text', default => 'default text') %] |
|
80
|
|
|
|
|
|
|
[% form.submit %] |
|
81
|
|
|
|
|
|
|
[% form.end_form %] |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
With CGI: |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
cgi-script: |
|
88
|
|
|
|
|
|
|
use Template; |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
print "Content-Type: text/html\n\n"; |
|
91
|
|
|
|
|
|
|
my $tt = Template->new(); |
|
92
|
|
|
|
|
|
|
$tt->process('my_template.tt'); |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
my_template.tt: |
|
95
|
|
|
|
|
|
|
[% USE CGI %] |
|
96
|
|
|
|
|
|
|
[% USE form = HTML.SuperForm %] |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
[% form.start_form(name => 'my_form') %] |
|
100
|
|
|
|
|
|
|
[% form.text(name => 'my_text', default => 'default text') %] |
|
101
|
|
|
|
|
|
|
[% form.submit %] |
|
102
|
|
|
|
|
|
|
[% form.end_form %] |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Without CGI or mod_perl: |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
cgi-script: |
|
109
|
|
|
|
|
|
|
use Template; |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
print "Content-Type: text/html\n\n"; |
|
112
|
|
|
|
|
|
|
my $tt = Template->new(); |
|
113
|
|
|
|
|
|
|
$tt->process('my_template.tt'); |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
my_template.tt: |
|
116
|
|
|
|
|
|
|
[% USE form = HTML.SuperForm %] |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
[% form.start_form(name => 'my_form') %] |
|
120
|
|
|
|
|
|
|
[% form.text(name => 'my_text', default => 'default text') %] |
|
121
|
|
|
|
|
|
|
[% form.submit %] |
|
122
|
|
|
|
|
|
|
[% form.end_form %] |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
HTML::SuperForm |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 AUTHOR |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
John Allwine Ejallwine86@yahoo.comE |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=cut |