in reply to Re^3: HTML Template
in thread HTML Template
Assume users A and B access the form at the same time, both should get a different key set on their respective form. Am I right?use CGI; our $q = new CGI; sub do_form { my $href; $href->{key} = md5_hex(time() . '-' . $$ . '-' . rand()); to_template( output => $href, tmpl => 'form.tt' ); } sub to_template { my %hash = @_; print $q->header; require Template; my $template = HTML::Template -> new(filename => "/templates/$hash +{tmpl}"); $template->param(map { defined $hash{output}->{$_} ? ($_ => $hash{ +output}->{$_}) : () } keys %{$hash{output}}); print $template->output; } sub process_form { my $params = $q->Vars; debug($params->{key}); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: HTML Template
by punkish (Priest) on Jun 14, 2010 at 03:16 UTC | |
by Anonymous Monk on Jun 14, 2010 at 03:22 UTC | |
by punkish (Priest) on Jun 14, 2010 at 05:36 UTC | |
by Anonymous Monk on Jun 14, 2010 at 07:55 UTC |