File Coverage

blib/lib/HTML/FormEngine/Handler.pm
Criterion Covered Total %
statement 3 205 1.4
branch 0 122 0.0
condition 0 70 0.0
subroutine 1 21 4.7
pod n/a
total 4 418 0.9


line stmt bran cond sub pod time code
1             =head1 NAME
2              
3             HTML::FormEngine::Handler - FormEngine template handler
4              
5             =head1 HANDLERS
6              
7             =cut
8              
9             ######################################################################
10              
11             package HTML::FormEngine::Handler;
12              
13 1     1   5 use Locale::gettext;
  1         2  
  1         2756  
14              
15             ######################################################################
16              
17             =head2 default
18              
19             The default handler is called if the named handler doesn't exist.
20              
21             With help of the default handler one can nest templates. It expects
22             the name, with which it was called, to be the name of an template. It
23             then reads in this template and processes it. The resulting code is
24             returned.
25              
26             =cut
27              
28             ######################################################################
29              
30             sub _handle_default {
31 0     0     my ($self,$templ,@args) = @_;
32 0 0 0       if(defined($templ) && defined($self->{skin_obj}->get_templ($templ))) {
33 0           my $back = $self->{_handle_default};
34 0 0         $self->{_handle_default} = (@args ? \@args : undef);
35 0           my $res = $self->_parse($self->{skin_obj}->get_templ($templ));
36 0           $self->{_handle_default} = $back;
37 0           return $res;
38             }
39 0           return '';
40             }
41              
42             ######################################################################
43              
44             =head2 checked
45              
46             This handler is used in the I
47             templates.
48              
49             The first argument defines the value, which should be returned if a
50             certain option was submitted. By default this is 'checked'.
51              
52             The second argument defines the name of the variable in which the
53             option values are stored (default: OPT_VAL).
54              
55             The third argument defines the name of the variable which defines the
56             field name (default: NAME).
57              
58             ..or if you want to know it more exactly:
59              
60             The first argument is returned if the field was selected. If this
61             argument is not defined, I is returned. If the field wasn't
62             selected, an empty string is returned.
63              
64             The second argument is the name of the variable in which the value of
65             the field is defined which is submitted if the field was selected. By
66             default the value of this argument is I.
67              
68             The third argument contains the name of the variable in which the name
69             of the field is stored. With the help of this variable the submitted
70             value of the field is read in to be compared with the value which the
71             field should have if it was selected. So the handler can determine
72             whether the field was selected or not. By default this argument is
73             I.
74              
75             Normally the only important argument is the first one. The others can
76             be important if you want to change variable names.
77              
78             =cut
79              
80             ######################################################################
81              
82             sub _handle_checked {
83 0     0     my($self, $caller, $res, $namevar, $valuevar) = @_;
84 0 0         $res = 'checked' if(! defined($res));
85              
86             #we use a little dirty hack to get the whole VALUE contents and not the element corresponding to the loop-level
87             #we want the whole because the user of this module just specifies e.g. VALUE = [1,2,7] to say that he wants the checkboxes
88             #representing the values 1,2,7 to be checked. If we would consider the loop level he'd have to say e.g. VALUE = [1,2,,,,7]
89             #if the form was submitted this hack doesn't have any effect.
90 0           my $loop;
91             #...choosing the loop-status that matters...
92 0 0         if(defined($self->{loop_var}->{'VALUE'})) {
93 0           $loop = \$self->{loop_var}->{'VALUE'};
94             } else {
95 0           $loop = \$self->{loop};
96             }
97              
98             #temporaly reseting the loop-level (we pretend not to be in any loop)
99 0           local $_ = $$loop;
100 0           $$loop = [];
101 0           my $checked = $self->_get_value($namevar);
102 0           $$loop = $_;
103              
104             #i don't know if that is a good idea...
105 0 0         return '' unless($checked ne '');
106              
107 0   0       my $value = $self->_get_var($valuevar||'OPT_VAL');
108 0           my $input = '';
109             #we just have to check if one of the submitted values matches $value
110 0 0         if(ref($checked) eq 'ARRAY') {
    0          
111 0 0         if(grep {$_ eq $value} @{$checked}) {
  0            
  0            
112 0           return $res;
113             }
114             }
115             #..even easier
116             elsif($checked eq $value) {
117 0           return $res;
118             }
119 0           return '';
120             }
121              
122             ######################################################################
123              
124             =head2 value
125              
126             This handler returns the value of the field.
127              
128             The first argument defines the value which should be returned if the
129             value is empty. By default this is undef.
130              
131             If the second argument is true (1), the returned value will be
132             returned again next time the handler is called for this field name.
133              
134             The third argument is used to tell the handler the name of the
135             variable in which the field name is stored. By default this is
136             I.
137              
138             The fourth argument should be set to the name of the variable which
139             contains the fields value. By default this is I.
140              
141             If the form wasn't submitted, the fields default value is returned.
142              
143             =cut
144              
145             ######################################################################
146              
147             sub _handle_value {
148 0     0     my ($self,$caller,$none,$same,$namevar,$valuevar) = @_;
149 0           $res = $self->_get_value($namevar,$valuevar);
150 0 0         if(ref($res) eq 'ARRAY') {
151 0   0       $_ = $self->_get_var($namevar||'NAME');
152 0 0         if(ref($self->{_handle_value}) ne 'HASH') {
153 0           $self->{_handle_value} = {};
154             # this hash must be cleaned before calling make again!!
155 0     0     push @{$self->{call_before_make}}, sub { my ($self) = @_; $self->{_handle_value} = {}; };
  0            
  0            
  0            
156             # seperate handler should reset _handle_value so that the count starts again from 0
157 0           push @{$self->{reset_on_seperate}}, '_handle_value';
  0            
158             }
159 0 0         if(!$same) {
    0          
    0          
160 0   0       $res = $res->[$self->{_handle_value}->{$_}++ || 0];
161             }
162             #next call the same value should be returned for this field name
163             elsif($same > 0) {
164 0   0       $res = $res->[$self->{_handle_value}->{$_} || 0];
165             }
166             elsif($same < 0) {
167 0 0 0       $res = $res->[(defined($self->{_handle_value}->{$_}) and $self->{_handle_value}->{$_} > 0) ? $self->{_handle_value}->{$_} -1 : 0];
168             }
169             }
170 0 0 0       return (defined($res) and $res ne '') ? $res : $none;
171             }
172              
173             ######################################################################
174              
175             =head2 error, error_in, error_check
176              
177             The first argument sets the name of the variable in which the error
178             checks are set. By default this is I.
179              
180             The second argument sets the name of the variable in which the fields
181             name is stored. By default this is I.
182              
183             The third argument sets the name of the variable which contains the
184             fields value. By default this is I but if error_check was used
185             as handler name the default is I.
186              
187             If the last argument is set to true (1) no checking will be done, that
188             means that also no error can be returned. This can only be usefull for
189             debugging.
190              
191             The handler calls the defined error checks until an error message is
192             returned or all checks were called. If it retrieves an error message
193             it returns this message or the message given by the [checkmethod,
194             errormessage, arg1, ... argn] notation, else NULL is returned.
195              
196             =cut
197              
198             ######################################################################
199              
200             sub _handle_error {
201 0     0     my ($self,$caller,$keyvar,$namevar,$valuevar,$nocheck) = @_;
202 0 0 0       if($self->is_submitted && $self->{check_error}) {
203 0   0       my $check = $self->_get_var($keyvar||'ERROR');
204 0 0 0       $check = [ $check ] if(defined($check) and ref($check) ne 'ARRAY' and $check ne '');
      0        
205 0 0 0       if(ref($check) eq 'ARRAY' and @{$check}) {
  0            
206 0   0       my $name = $self->_get_var($namevar||'NAME');
207 0           my $value = $self->_get_value($namevar,$valuevar,1);
208              
209             # #error_in calls should only check exactly one value
210 0 0 0       if($caller eq '#error_in' && ref($value) eq 'ARRAY') {
    0          
211 0 0         if (ref($self->{_handle_error}) ne 'HASH') {
212 0           $self->{_handle_error} = {};
213 0     0     push @{$self->{call_before_make}}, sub { my($self) = @_; $self->{_handle_error} = {}; };
  0            
  0            
  0            
214             # seperate handler should reset _handle_error so that the count starts again from 0
215 0           push @{$self->{reset_on_seperate}}, '_handle_error';
  0            
216             }
217 0   0       $value = $value->[$self->{_handle_error}->{$name}++ || 0];
218             }
219              
220             # error_check is designed to be used in templates like radio, checkbox and select
221             elsif($caller eq '#error_check') {
222 0 0         $value = [$value] if(ref($value) ne 'ARRAY');
223 0   0       my $optval = $self->_get_var($valuevar || 'OPT_VAL');
224 0 0         if(grep {$optval eq $_} @$value) {
  0            
225 0           $value = $optval;
226             }
227             else {
228 0           $value = '';
229             }
230             }
231              
232 0 0         unless($nocheck) {
233 0           foreach my $chk (@{$check}) {
  0            
234 0           my $errmsg = '';
235 0           my @args = ();
236 0 0         if(ref($chk) ne 'CODE') {
237             #this implements the [checkmethod, errmsg, arg1, arg2, ... argn] notation
238 0 0         if(ref($chk) eq 'ARRAY') {
239             #add the name of the call alias infront of the argument list
240 0           push @args, $chk->[0];
241 0           $errmsg = $chk->[1];
242 0 0         push @args, @$chk[2..@{$chk}-1] if(@{$chk} >= 3);
  0            
  0            
243 0           $chk = $chk->[0];
244             }
245             else {
246             #add the name of the call alias infront of the argument list
247 0           push @args, $chk;
248             }
249 0           $chk = $self->{skin_obj}->get_check($chk);
250             }
251 0 0         if(ref($chk) eq 'CODE') {
252 0           local $_ = undef;
253 0 0         if($_ = &$chk($value, $self, @args)) {
254 0           $self->{errcount} ++;
255 0   0       return $self->_get_var('errmsg') || $errmsg || $_;
256             }
257             }
258             }
259             }
260             }
261             }
262 0           return '';
263             }
264              
265             ######################################################################
266              
267             =head2 gettext
268              
269             The arguments given to this handler, are passed through gettext and
270             then joined together with a spacing blank inbetween. The resulting
271             string is returned.
272              
273             =cut
274              
275             ######################################################################
276              
277             sub _handle_gettext {
278 0     0     my ($self,$caller) = (shift,shift);
279 0           my @res;
280 0           foreach $_ (@_) {
281 0           push @res, gettext($_);
282             }
283 0           return join(' ', @res);
284             }
285              
286             ######################################################################
287              
288             =head2 gettext_var
289              
290             You can pass variable names to this handler. The values of those
291             variables are then pushed through gettext and the resulting strings
292             are glued together with a blank inbetween.
293              
294             =cut
295              
296             ######################################################################
297              
298             sub _handle_gettext_var {
299 0     0     my ($self,$caller) = (shift,shift);
300 0           my @res;
301 0           foreach $_ (@_) {
302             #get content of variable
303 0           $_ = $self->_get_var($_);
304 0 0         push @res, gettext($_) if($_ ne '');
305             }
306 0           return join(' ', @res);
307             }
308              
309             ######################################################################
310              
311             =head2 label
312              
313             This handler gets the id, title and accesskey value and uses this
314             informations to create a (X)HTML C<<
315              
316             The first argument should be set to the name of the variable which
317             provides the fields title, by default this is I. </td> </tr> <tr> <td class="h" > <a name="318">318</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="319">319</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> The seconds argument default is I<ID>. It should be always set to the </td> </tr> <tr> <td class="h" > <a name="320">320</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> variable which contains the fields id. </td> </tr> <tr> <td class="h" > <a name="321">321</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="322">322</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> The third argument is used to try to get an accesskey for the </td> </tr> <tr> <td class="h" > <a name="323">323</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> field. Normally the variable ACCESSKEY is expected to provide such, if </td> </tr> <tr> <td class="h" > <a name="324">324</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> you prefer to use another variable please give its name here. </td> </tr> <tr> <td class="h" > <a name="325">325</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="326">326</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =cut </td> </tr> <tr> <td class="h" > <a name="327">327</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="328">328</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="329">329</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="330">330</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> sub _handle_label { </td> </tr> <tr> <td class="h" > <a name="331">331</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--subroutine.html#331-1"> 0 </a> </td> <td >   </td> <td >   </td> <td class="s"> my($self,$caller,$labelvar,$idvar,$accesskeyvar) = @_; </td> </tr> <tr> <td class="h" > <a name="332">332</a> </td> <td class="c0" > 0 </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--condition.html#332-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> my $label = $self->_get_var($labelvar||'TITLE'); </td> </tr> <tr> <td class="h" > <a name="333">333</a> </td> <td class="c0" > 0 </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--condition.html#333-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> my $id = $self->_get_var($idvar||'ID'); </td> </tr> <tr> <td class="h" > <a name="334">334</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #the label tag doesn't make sense without a label </td> </tr> <tr> <td class="h" > <a name="335">335</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#335-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return '' if(!$label); </td> </tr> <tr> <td class="h" > <a name="336">336</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #the label tag doesn't make sense without an id, we also should parse it if things like <& are contained </td> </tr> <tr> <td class="h" > <a name="337">337</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #its not necessary anymore because this is done by _get_var anyway </td> </tr> <tr> <td class="h" > <a name="338">338</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #return $self->_parse($label) if(ref($id) || !defined($id) || $label =~ /<(&|~|!).*(!|~|&)>/); </td> </tr> <tr> <td class="h" > <a name="339">339</a> </td> <td class="c0" > 0 </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--condition.html#339-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> my $accesskey = $self->_get_var($accesskeyvar||'ACCESSKEY'); </td> </tr> <tr> <td class="h" > <a name="340">340</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#340-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $accesskey='' unless(defined($accesskey)); </td> </tr> <tr> <td class="h" > <a name="341">341</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return "<label for=\"$id\" accesskey=\"$accesskey\">$label</label>"; </td> </tr> <tr> <td class="h" > <a name="342">342</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="343">343</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="344">344</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="345">345</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="346">346</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =head2 decide </td> </tr> <tr> <td class="h" > <a name="347">347</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="348">348</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> Expects a list of variable names, it then returns the content of the </td> </tr> <tr> <td class="h" > <a name="349">349</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> first variable in the list which is not empty. </td> </tr> <tr> <td class="h" > <a name="350">350</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="351">351</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =cut </td> </tr> <tr> <td class="h" > <a name="352">352</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="353">353</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="354">354</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="355">355</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> sub _handle_decide { </td> </tr> <tr> <td class="h" > <a name="356">356</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--subroutine.html#356-1"> 0 </a> </td> <td >   </td> <td >   </td> <td class="s"> my($self,$caller,@vars) = @_; </td> </tr> <tr> <td class="h" > <a name="357">357</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> foreach $_ (@vars) { </td> </tr> <tr> <td class="h" > <a name="358">358</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> my $value = $self->_get_var($_,1); </td> </tr> <tr> <td class="h" > <a name="359">359</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#359-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return $self->_parse($value) if(defined($value)); </td> </tr> <tr> <td class="h" > <a name="360">360</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="361">361</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return ''; </td> </tr> <tr> <td class="h" > <a name="362">362</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="363">363</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="364">364</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="365">365</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="366">366</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =head2 readonly </td> </tr> <tr> <td class="h" > <a name="367">367</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="368">368</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> Expects the name of the variable which says whether the field should </td> </tr> <tr> <td class="h" > <a name="369">369</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> be set readonly or not. By default this is I<READONLY>. </td> </tr> <tr> <td class="h" > <a name="370">370</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> C<readonly="readonly"> is returned if that variable is set to 1 (true). </td> </tr> <tr> <td class="h" > <a name="371">371</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="372">372</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =cut </td> </tr> <tr> <td class="h" > <a name="373">373</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="374">374</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="375">375</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="376">376</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> sub _handle_readonly { </td> </tr> <tr> <td class="h" > <a name="377">377</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--subroutine.html#377-1"> 0 </a> </td> <td >   </td> <td >   </td> <td class="s"> my($self,$caller,$readonlyvar) = @_; </td> </tr> <tr> <td class="h" > <a name="378">378</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#378-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $readonlyvar = 'READONLY' unless($readonlyvar); </td> </tr> <tr> <td class="h" > <a name="379">379</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#379-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return 'readonly="readonly"' if($self->_get_var($readonlyvar,1)); </td> </tr> <tr> <td class="h" > <a name="380">380</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return ''; </td> </tr> <tr> <td class="h" > <a name="381">381</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="382">382</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="383">383</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="384">384</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="385">385</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =head2 multiple </td> </tr> <tr> <td class="h" > <a name="386">386</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="387">387</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> Works like C<readonly> but C<multiple="multiple"> is returned if </td> </tr> <tr> <td class="h" > <a name="388">388</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> I<MULTIPLE> is true. </td> </tr> <tr> <td class="h" > <a name="389">389</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="390">390</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =cut </td> </tr> <tr> <td class="h" > <a name="391">391</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="392">392</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="393">393</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="394">394</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> sub _handle_multiple { </td> </tr> <tr> <td class="h" > <a name="395">395</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--subroutine.html#395-1"> 0 </a> </td> <td >   </td> <td >   </td> <td class="s"> my($self,$caller,$multiplevar) = @_; </td> </tr> <tr> <td class="h" > <a name="396">396</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#396-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $multiplevar = 'MULTIPLE' unless($multiplevar); </td> </tr> <tr> <td class="h" > <a name="397">397</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#397-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return 'multiple="multiple"' if($self->_get_var($multiplevar,1)); </td> </tr> <tr> <td class="h" > <a name="398">398</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return ''; </td> </tr> <tr> <td class="h" > <a name="399">399</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="400">400</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="401">401</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="402">402</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="403">403</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =head2 confirm_check_prepare </td> </tr> <tr> <td class="h" > <a name="404">404</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="405">405</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> This handler is a confirm handler. It sets the variables I<OPTION> and </td> </tr> <tr> <td class="h" > <a name="406">406</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> I<OPT_VAL> to the list of submitted values resp. their visible </td> </tr> <tr> <td class="h" > <a name="407">407</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> names. This is usefull because like that only the really submitted </td> </tr> <tr> <td class="h" > <a name="408">408</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> values and options are printed when the template iterates over OPTION </td> </tr> <tr> <td class="h" > <a name="409">409</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> and/or OPT_VAL. </td> </tr> <tr> <td class="h" > <a name="410">410</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="411">411</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> With the first argument you can set how many options/values you want to </td> </tr> <tr> <td class="h" > <a name="412">412</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> have per line when iterating. By default this is 2. Internally it just </td> </tr> <tr> <td class="h" > <a name="413">413</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> configurs how many elements every array should have. </td> </tr> <tr> <td class="h" > <a name="414">414</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="415">415</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> The second argument is by default I<OPTION> and should always be set </td> </tr> <tr> <td class="h" > <a name="416">416</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> to the name of the variable which provides the option list. </td> </tr> <tr> <td class="h" > <a name="417">417</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="418">418</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> The third argument configures which variable should be read in to get </td> </tr> <tr> <td class="h" > <a name="419">419</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> the list of submitted values. By default this is I<OPT_VAL>. </td> </tr> <tr> <td class="h" > <a name="420">420</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="421">421</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> The fourth argument should be set to the right variable name if the </td> </tr> <tr> <td class="h" > <a name="422">422</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> variable which contains the fields name is not I<NAME> (normally it is </td> </tr> <tr> <td class="h" > <a name="423">423</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> I<NAME>). </td> </tr> <tr> <td class="h" > <a name="424">424</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="425">425</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =cut </td> </tr> <tr> <td class="h" > <a name="426">426</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="427">427</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="428">428</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="429">429</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> sub _handle_confirm_check_prepare { </td> </tr> <tr> <td class="h" > <a name="430">430</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--subroutine.html#430-1"> 0 </a> </td> <td >   </td> <td >   </td> <td class="s"> my($self,$caller,$perline,$optionvar,$optvalvar,$namevar) = @_; </td> </tr> <tr> <td class="h" > <a name="431">431</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#431-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $perline = 2 unless($perline); </td> </tr> <tr> <td class="h" > <a name="432">432</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #get list of submitted values </td> </tr> <tr> <td class="h" > <a name="433">433</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> my $value = $self->_get_value($namevar); </td> </tr> <tr> <td class="h" > <a name="434">434</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#434-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $value = [$value] unless(ref($value) eq 'ARRAY'); </td> </tr> <tr> <td class="h" > <a name="435">435</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #get list of all options </td> </tr> <tr> <td class="h" > <a name="436">436</a> </td> <td class="c0" > 0 </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--condition.html#436-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> my $option = $self->_get_var($optionvar||'OPTION'); </td> </tr> <tr> <td class="h" > <a name="437">437</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#437-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $option = [$self->_flatten_array(ref($option) eq 'ARRAY' ? @$option : $option)]; </td> </tr> <tr> <td class="h" > <a name="438">438</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #get list of all values </td> </tr> <tr> <td class="h" > <a name="439">439</a> </td> <td class="c0" > 0 </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--condition.html#439-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> my $optval = $self->_get_var($optvalvar||'OPT_VAL'); </td> </tr> <tr> <td class="h" > <a name="440">440</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#440-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $optval = [$self->_flatten_array(ref($optval) eq 'ARRAY' ? @$optval : $optval)]; </td> </tr> <tr> <td class="h" > <a name="441">441</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> my %option; </td> </tr> <tr> <td class="h" > <a name="442">442</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #create a optval => option map </td> </tr> <tr> <td class="h" > <a name="443">443</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> for(my $i=0; $i<@$option; $i++) { </td> </tr> <tr> <td class="h" > <a name="444">444</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $option{$optval->[$i]} = $option->[$i]; </td> </tr> <tr> <td class="h" > <a name="445">445</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="446">446</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> my @optcache = (), my @valcache = (); </td> </tr> <tr> <td class="h" > <a name="447">447</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> my @option = (); </td> </tr> <tr> <td class="h" > <a name="448">448</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> my @value = (); </td> </tr> <tr> <td class="h" > <a name="449">449</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $i = 0; </td> </tr> <tr> <td class="h" > <a name="450">450</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #now create the new option and value list which then only contains the submitted values/options </td> </tr> <tr> <td class="h" > <a name="451">451</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> foreach $_ (@$value) { </td> </tr> <tr> <td class="h" > <a name="452">452</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#452-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> if(defined($option{$_})) { </td> </tr> <tr> <td class="h" > <a name="453">453</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> push @optcache, $option{$_}; </td> </tr> <tr> <td class="h" > <a name="454">454</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> push @valcache, $_; </td> </tr> <tr> <td class="h" > <a name="455">455</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $i++; </td> </tr> <tr> <td class="h" > <a name="456">456</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #when iterating the first array dimension creates the rows, the second fills up the columns </td> </tr> <tr> <td class="h" > <a name="457">457</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#457-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> if(!($i % $perline)) { </td> </tr> <tr> <td class="h" > <a name="458">458</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> push @option, [@optcache]; </td> </tr> <tr> <td class="h" > <a name="459">459</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> push @value, [@valcache]; </td> </tr> <tr> <td class="h" > <a name="460">460</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> @optcache = (); </td> </tr> <tr> <td class="h" > <a name="461">461</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> @valcache = (); </td> </tr> <tr> <td class="h" > <a name="462">462</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="463">463</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="464">464</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="465">465</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #we probably have to fill up the last row </td> </tr> <tr> <td class="h" > <a name="466">466</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #while($i % $perline and $i > 0) { </td> </tr> <tr> <td class="h" > <a name="467">467</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #i don't know why, but when i enable this namechooser.cgi ends up in an endless loop when the confirm-form is being generated </td> </tr> <tr> <td class="h" > <a name="468">468</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #push @optcache, ''; </td> </tr> <tr> <td class="h" > <a name="469">469</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #$i++; </td> </tr> <tr> <td class="h" > <a name="470">470</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #} </td> </tr> <tr> <td class="h" > <a name="471">471</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#471-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> push @option, [@optcache] if(@optcache); </td> </tr> <tr> <td class="h" > <a name="472">472</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#472-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> push @value, [@valcache] if(@valcache); </td> </tr> <tr> <td class="h" > <a name="473">473</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $self->_set_var('OPTION', \@option); </td> </tr> <tr> <td class="h" > <a name="474">474</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $self->_set_var('OPT_VAL', \@value); </td> </tr> <tr> <td class="h" > <a name="475">475</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return ''; </td> </tr> <tr> <td class="h" > <a name="476">476</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="477">477</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="478">478</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="479">479</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="480">480</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="481">481</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =head2 seperate </td> </tr> <tr> <td class="h" > <a name="482">482</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="483">483</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> First of all: The handler doesn't do anything if the C<set_seperate> </td> </tr> <tr> <td class="h" > <a name="484">484</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> method was not called with a true value! </td> </tr> <tr> <td class="h" > <a name="485">485</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="486">486</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> If set_seperate was called with a true value, this handler returns a </td> </tr> <tr> <td class="h" > <a name="487">487</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> seperation-field if the fieldname changes while iterating or if a </td> </tr> <tr> <td class="h" > <a name="488">488</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> template came to its end. Of course that only works when used in the </td> </tr> <tr> <td class="h" > <a name="489">489</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> right way in the templates. </td> </tr> <tr> <td class="h" > <a name="490">490</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="491">491</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> The seperation-field is important because it controlls which values of </td> </tr> <tr> <td class="h" > <a name="492">492</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> a certain fieldname belong together and are thus packed into one </td> </tr> <tr> <td class="h" > <a name="493">493</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> subarray of the C<get_input> result for that fieldname. </td> </tr> <tr> <td class="h" > <a name="494">494</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="495">495</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> E.g.: you've a field called I<name> which consists of two text-inputs, </td> </tr> <tr> <td class="h" > <a name="496">496</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> one for the first- and one for the lastname. If you now call </td> </tr> <tr> <td class="h" > <a name="497">497</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> C<get_input('name')> it'll return: [firstname,lastname]. So far no </td> </tr> <tr> <td class="h" > <a name="498">498</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> problem. The problem comes if you use this I<name> field twice </td> </tr> <tr> <td class="h" > <a name="499">499</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> e.g. because you want to get the data of 2 persons in one form. Now </td> </tr> <tr> <td class="h" > <a name="500">500</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> FormEngine normally would think that all four belong together: </td> </tr> <tr> <td class="h" > <a name="501">501</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> [firstname,lastname,firstname,lastname] but with the help of the </td> </tr> <tr> <td class="h" > <a name="502">502</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> seperation field which will automatically be inserted inbetween, it </td> </tr> <tr> <td class="h" > <a name="503">503</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> knows that the following is to be expected: </td> </tr> <tr> <td class="h" > <a name="504">504</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> [[firstname,lastname],[firstname,lastname]]. So far that isn't so </td> </tr> <tr> <td class="h" > <a name="505">505</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> important, but it really gets important for the radio,select and </td> </tr> <tr> <td class="h" > <a name="506">506</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> checkbox fields, because here FormEngine must know which values belong </td> </tr> <tr> <td class="h" > <a name="507">507</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> to which group and so on. </td> </tr> <tr> <td class="h" > <a name="508">508</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="509">509</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> One might think: why do people not just use diffrent names? Well, i </td> </tr> <tr> <td class="h" > <a name="510">510</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> would say it is much more easier to define and also much more easy </td> </tr> <tr> <td class="h" > <a name="511">511</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> to evaluate the return value if fields who semanticlly belong </td> </tr> <tr> <td class="h" > <a name="512">512</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> together have the same name. If you would give the fields for each </td> </tr> <tr> <td class="h" > <a name="513">513</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> person its own name like name1, name2 ... it'll be not so nice to call </td> </tr> <tr> <td class="h" > <a name="514">514</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> get_value() for each person especially if the count of persons is </td> </tr> <tr> <td class="h" > <a name="515">515</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> flexible. So its much nicer to just call get_value(name) and then to </td> </tr> <tr> <td class="h" > <a name="516">516</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> know that each subarray represents one person. </td> </tr> <tr> <td class="h" > <a name="517">517</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="518">518</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> The first argument is attached to the seperation-field-code. If the </td> </tr> <tr> <td class="h" > <a name="519">519</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> second argument is set to true (1) the sepeartion-field-code will be </td> </tr> <tr> <td class="h" > <a name="520">520</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> returned in any case (if set_seperate was called with a true </td> </tr> <tr> <td class="h" > <a name="521">521</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> value). The third argument is by default I<NAME> and should always be </td> </tr> <tr> <td class="h" > <a name="522">522</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> set to the variable which contains the fields name. </td> </tr> <tr> <td class="h" > <a name="523">523</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="524">524</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =cut </td> </tr> <tr> <td class="h" > <a name="525">525</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="526">526</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="527">527</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="528">528</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> sub _handle_seperate { </td> </tr> <tr> <td class="h" > <a name="529">529</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--subroutine.html#529-1"> 0 </a> </td> <td >   </td> <td >   </td> <td class="s"> my($self,$caller,$attach,$clear,$namevar) = @_; </td> </tr> <tr> <td class="h" > <a name="530">530</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #only if set_seperate() was called and set to true this handler shall do something </td> </tr> <tr> <td class="h" > <a name="531">531</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#531-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return '' unless($self->{seperate}); </td> </tr> <tr> <td class="h" > <a name="532">532</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> my $res = ''; </td> </tr> <tr> <td class="h" > <a name="533">533</a> </td> <td class="c0" > 0 </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--condition.html#533-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> my $name = $self->_get_var($namevar||'NAME',1); </td> </tr> <tr> <td class="h" > <a name="534">534</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#534-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> if (ref($self->{_handle_seperate}) ne 'ARRAY') { </td> </tr> <tr> <td class="h" > <a name="535">535</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $self->{_handle_seperate} = []; </td> </tr> <tr> <td class="h" > <a name="536">536</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--subroutine.html#536-1"> 0 </a> </td> <td >   </td> <td >   </td> <td class="s"> push @{$self->{call_before_make}}, sub { my($self) = @_; $self->{_handle_seperate} = []; }; </td> </tr> <tr> <td class="h" > <a > </a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a > </a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a > </a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="537">537</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="538">538</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #seperation works per level, that means that when the fieldname changes from one to another level that has no effect, only changes on the same level matter </td> </tr> <tr> <td class="h" > <a name="539">539</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> my $old = $self->{_handle_seperate}->[$self->{depth}]; </td> </tr> <tr> <td class="h" > <a name="540">540</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #if clear is true or the fieldname changed... </td> </tr> <tr> <td class="h" > <a name="541">541</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#541-1"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--condition.html#541-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> if($clear || (defined($old) and $old ne $name)) { </td> </tr> <tr> <td class="h" > <a > </a> </td> <td >   </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--condition.html#-2"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="542">542</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#542-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> local $_ = defined($old) ? $old : $name; </td> </tr> <tr> <td class="h" > <a name="543">543</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> #create the seperation field </td> </tr> <tr> <td class="h" > <a name="544">544</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#544-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $res = $self->_parse('<input type="hidden" name="'.$_.'" value="<&SEPVAL&>" />' . (defined($attach) ? $attach : '')) unless($caller eq '#seperate_conly'); </td> </tr> <tr> <td class="h" > <a > </a> </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#-2"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="545">545</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> # </td> </tr> <tr> <td class="h" > <a name="546">546</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $self->{values}->{$_} ++; </td> </tr> <tr> <td class="h" > <a name="547">547</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> foreach my $key (@{$self->{reset_on_seperate}}) { </td> </tr> <tr> <td class="h" > <a > </a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="548">548</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $self->{$key}->{$_} = 0; </td> </tr> <tr> <td class="h" > <a name="549">549</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="550">550</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="551">551</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#551-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $self->{_handle_seperate}->[$self->{depth}] = ($clear ? undef : $name); </td> </tr> <tr> <td class="h" > <a name="552">552</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return $res; </td> </tr> <tr> <td class="h" > <a name="553">553</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="554">554</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="555">555</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="556">556</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="557">557</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =head2 encentities </td> </tr> <tr> <td class="h" > <a name="558">558</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="559">559</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> This handler expects a variable name. It then fetches the variables </td> </tr> <tr> <td class="h" > <a name="560">560</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> contents and passes it through encode_entities so that all HTML </td> </tr> <tr> <td class="h" > <a name="561">561</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> entities are encoded. The resulting string is returned. </td> </tr> <tr> <td class="h" > <a name="562">562</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="563">563</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =cut </td> </tr> <tr> <td class="h" > <a name="564">564</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="565">565</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="566">566</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="567">567</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> sub _handle_encentities { </td> </tr> <tr> <td class="h" > <a name="568">568</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--subroutine.html#568-1"> 0 </a> </td> <td >   </td> <td >   </td> <td class="s"> my($self,$caller,$var) = @_; </td> </tr> <tr> <td class="h" > <a name="569">569</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#569-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return '' unless(defined($var)); </td> </tr> <tr> <td class="h" > <a name="570">570</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> require HTML::Entities; </td> </tr> <tr> <td class="h" > <a name="571">571</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return encode_entities($self->_get_var($var)); </td> </tr> <tr> <td class="h" > <a name="572">572</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="573">573</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="574">574</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="575">575</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="576">576</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =head2 save_to_global </td> </tr> <tr> <td class="h" > <a name="577">577</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="578">578</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> The handlers first argument can be any template expression (like </td> </tr> <tr> <td class="h" > <a name="579">579</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> <&NAME&> or <&value ,1&>), the second argument is by default I<saved> </td> </tr> <tr> <td class="h" > <a name="580">580</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> and should always be set to a string which is not yet used as variable </td> </tr> <tr> <td class="h" > <a name="581">581</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> name anywhere in the template (at least it normally will make most </td> </tr> <tr> <td class="h" > <a name="582">582</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> sense if it is not used anywhere, in some cases might be usefull to </td> </tr> <tr> <td class="h" > <a name="583">583</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> use an existing name). </td> </tr> <tr> <td class="h" > <a name="584">584</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="585">585</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> The handler will then read in the value of the expression given as </td> </tr> <tr> <td class="h" > <a name="586">586</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> first argument and will save it to the variable given as second </td> </tr> <tr> <td class="h" > <a name="587">587</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> argument but as a global variable, that means that value will then be </td> </tr> <tr> <td class="h" > <a name="588">588</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> available in every template if the variable is not overwritten by a </td> </tr> <tr> <td class="h" > <a name="589">589</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> local variable. </td> </tr> <tr> <td class="h" > <a name="590">590</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="591">591</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> This handler is especially usefull in association with the C<fmatch> </td> </tr> <tr> <td class="h" > <a name="592">592</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> check method. </td> </tr> <tr> <td class="h" > <a name="593">593</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="594">594</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =cut </td> </tr> <tr> <td class="h" > <a name="595">595</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="596">596</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="597">597</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="598">598</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> sub _handle_save_to_global { </td> </tr> <tr> <td class="h" > <a name="599">599</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--subroutine.html#599-1"> 0 </a> </td> <td >   </td> <td >   </td> <td class="s"> my($self,$caller,$expr,$savetovar) = @_; </td> </tr> <tr> <td class="h" > <a name="600">600</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> my $val = $self->_parse($expr); </td> </tr> <tr> <td class="h" > <a name="601">601</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#601-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> if(defined($val)) { </td> </tr> <tr> <td class="h" > <a name="602">602</a> </td> <td class="c0" > 0 </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--condition.html#602-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $self->{varstack}->[0]->{$savetovar||'saved'} = $val; </td> </tr> <tr> <td class="h" > <a name="603">603</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="604">604</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return ''; </td> </tr> <tr> <td class="h" > <a name="605">605</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="606">606</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="607">607</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="608">608</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="609">609</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =head2 not_null </td> </tr> <tr> <td class="h" > <a name="610">610</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="611">611</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> The first argument is by default I<ERROR> and should always be set to </td> </tr> <tr> <td class="h" > <a name="612">612</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> the name of the variable which defines the error checks. </td> </tr> <tr> <td class="h" > <a name="613">613</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="614">614</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> The second argument is returned if the list of error checks contains </td> </tr> <tr> <td class="h" > <a name="615">615</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> the I<not_null> check, which means that the field mustn't be </td> </tr> <tr> <td class="h" > <a name="616">616</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> empty. What is to be returned by default is setted by the skin, </td> </tr> <tr> <td class="h" > <a name="617">617</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> normally it is the empty string (no mark). A good value would be </td> </tr> <tr> <td class="h" > <a name="618">618</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> e.g. I<*>. See L<HTML::FormEngine::Skin> on how to modify the default </td> </tr> <tr> <td class="h" > <a name="619">619</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> (C<set_not_null_string>). </td> </tr> <tr> <td class="h" > <a name="620">620</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="621">621</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> This handler is used to automatically mark fields which have to be </td> </tr> <tr> <td class="h" > <a name="622">622</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> filled out. </td> </tr> <tr> <td class="h" > <a name="623">623</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="624">624</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =cut </td> </tr> <tr> <td class="h" > <a name="625">625</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="626">626</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="627">627</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="628">628</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> sub _handle_not_null { </td> </tr> <tr> <td class="h" > <a name="629">629</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--subroutine.html#629-1"> 0 </a> </td> <td >   </td> <td >   </td> <td class="s"> my($self,$caller,$err_var,$res) = @_; </td> </tr> <tr> <td class="h" > <a name="630">630</a> </td> <td class="c0" > 0 </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--condition.html#630-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> my $err = $self->_get_var($err_var||'ERROR'); </td> </tr> <tr> <td class="h" > <a name="631">631</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#631-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return '' unless(defined($err)); </td> </tr> <tr> <td class="h" > <a name="632">632</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#632-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> $err = [$err] unless(ref($err) eq 'ARRAY'); </td> </tr> <tr> <td class="h" > <a name="633">633</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#633-1"> 0 </a> </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--condition.html#633-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return $res||$self->{skin_obj}->get_not_null_string() if(grep {defined($_) && $_ eq 'not_null'} @$err); </td> </tr> <tr> <td class="h" > <a > </a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#-2"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="634">634</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return ''; </td> </tr> <tr> <td class="h" > <a name="635">635</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="636">636</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="637">637</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="638">638</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="639">639</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =head2 html2text </td> </tr> <tr> <td class="h" > <a name="640">640</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="641">641</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> This handler expects a variable name as argument, it then fetches the </td> </tr> <tr> <td class="h" > <a name="642">642</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> value of the variable and passes it through </td> </tr> <tr> <td class="h" > <a name="643">643</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> C<HTML::Entities::decode_entities> before returning </td> </tr> <tr> <td class="h" > <a name="644">644</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> it. C<decode_entities> turns HTML entities like C<<> in their </td> </tr> <tr> <td class="h" > <a name="645">645</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> corresponding plain-text character. </td> </tr> <tr> <td class="h" > <a name="646">646</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="647">647</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =cut </td> </tr> <tr> <td class="h" > <a name="648">648</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="649">649</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="650">650</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="651">651</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> sub _handle_html2text { </td> </tr> <tr> <td class="h" > <a name="652">652</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--subroutine.html#652-1"> 0 </a> </td> <td >   </td> <td >   </td> <td class="s"> my($self,$caller,$var) = @_; </td> </tr> <tr> <td class="h" > <a name="653">653</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> require HTML::Entities; </td> </tr> <tr> <td class="h" > <a name="654">654</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#654-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return '' unless(defined($var)); </td> </tr> <tr> <td class="h" > <a name="655">655</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return HTML::Entities::decode_entities($self->_get_var($var)); </td> </tr> <tr> <td class="h" > <a name="656">656</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="657">657</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="658">658</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="659">659</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="660">660</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =head2 arg </td> </tr> <tr> <td class="h" > <a name="661">661</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="662">662</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> When calling a template you can pass arguments to it like this: C<< </td> </tr> <tr> <td class="h" > <a name="663">663</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> <&template arg0,arg1...,argn&> >> </td> </tr> <tr> <td class="h" > <a name="664">664</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="665">665</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> In the template you then use this handler to fetch the passed </td> </tr> <tr> <td class="h" > <a name="666">666</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> arguments. An example: C<< <&#arg 1&> >>. This will return I<arg1>. </td> </tr> <tr> <td class="h" > <a name="667">667</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="668">668</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =cut </td> </tr> <tr> <td class="h" > <a name="669">669</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="670">670</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="671">671</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="672">672</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> sub _handle_arg { </td> </tr> <tr> <td class="h" > <a name="673">673</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--subroutine.html#673-1"> 0 </a> </td> <td >   </td> <td >   </td> <td class="s"> my($self,$caller,@args) = @_; </td> </tr> <tr> <td class="h" > <a name="674">674</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> my @res; </td> </tr> <tr> <td class="h" > <a name="675">675</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> local $_; </td> </tr> <tr> <td class="h" > <a name="676">676</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> foreach $_ (@args) { </td> </tr> <tr> <td class="h" > <a name="677">677</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#677-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> if(ref($self->{_handle_default}->[$_]) eq 'ARRAY') { </td> </tr> <tr> <td class="h" > <a name="678">678</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> push @res, join(',',@{$self->{_handle_default}->[$_]}); </td> </tr> <tr> <td class="h" > <a > </a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="679">679</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="680">680</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> else { </td> </tr> <tr> <td class="h" > <a name="681">681</a> </td> <td class="c0" > 0 </td> <td >   </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--condition.html#681-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> push @res, $self->{_handle_default}->[$_]||''; </td> </tr> <tr> <td class="h" > <a name="682">682</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="683">683</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="684">684</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> my $res = join(',', @res); </td> </tr> <tr> <td class="h" > <a name="685">685</a> </td> <td class="c0" > 0 </td> <td class="c0" > <a href="blib-lib-HTML-FormEngine-Handler-pm--branch.html#685-1"> 0 </a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return $res if(defined($res)); </td> </tr> <tr> <td class="h" > <a name="686">686</a> </td> <td class="c0" > 0 </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return ''; </td> </tr> <tr> <td class="h" > <a name="687">687</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="688">688</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="689">689</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> ###################################################################### </td> </tr> <tr> <td class="h" > <a name="690">690</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="691">691</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =head1 WRITING A HANDLER </td> </tr> <tr> <td class="h" > <a name="692">692</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="693">693</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =head2 Design </td> </tr> <tr> <td class="h" > <a name="694">694</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="695">695</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> In general, a handler has the following structure: </td> </tr> <tr> <td class="h" > <a name="696">696</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="697">697</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> sub myhandler { </td> </tr> <tr> <td class="h" > <a name="698">698</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> my($self,$callname,@args) = @_; </td> </tr> <tr> <td class="h" > <a name="699">699</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> # ... some code ... # </td> </tr> <tr> <td class="h" > <a name="700">700</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> return $res; </td> </tr> <tr> <td class="h" > <a name="701">701</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="702">702</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="703">703</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> C<$self> contains a reference to the FormEngine object. </td> </tr> <tr> <td class="h" > <a name="704">704</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="705">705</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> C<$callname> contains the name or synonym which was used to call the </td> </tr> <tr> <td class="h" > <a name="706">706</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> handler. So it is possible to use the same handler for several, </td> </tr> <tr> <td class="h" > <a name="707">707</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> similar jobs. </td> </tr> <tr> <td class="h" > <a name="708">708</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="709">709</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> C<@args> contains the arguments which were passed to the handler (see </td> </tr> <tr> <td class="h" > <a name="710">710</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> Skin.pm). </td> </tr> <tr> <td class="h" > <a name="711">711</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="712">712</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =head2 Install </td> </tr> <tr> <td class="h" > <a name="713">713</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="714">714</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> Read L<HTML::FormEngine::Skin> on how to make your handlers </td> </tr> <tr> <td class="h" > <a name="715">715</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> available. To hardcode them into the skin edit its source code, also </td> </tr> <tr> <td class="h" > <a name="716">716</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> read about the other skin packages. </td> </tr> <tr> <td class="h" > <a name="717">717</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="718">718</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> =cut </td> </tr> <tr> <td class="h" > <a name="719">719</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="720">720</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> 1; </td> </tr> <tr> <td class="h" > <a name="721">721</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s">   </td> </tr> <tr> <td class="h" > <a name="722">722</a> </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td >   </td> <td class="s"> __END__ </td> </tr> </table> </body> </html>