nedals has asked for the wisdom of the Perl Monks concerning the following question:
I'll outline what I'm attemping to do just in case I'm misguided. This is a web application using CGI.pm and HTML::Template
In a module I create a hash
our %cgi_vars = $q->Vars; ## Collects all my form data
Within a .cgi script, I update values in the %cgi_vars hash and now want to transfer the new values into my .tmpl using associate. In order to do this, I (think) I need to put the values back into the $q->param() object.
foreach (keys %cgi_vars) { $q->param($_ => $cgi_vars{$_}); }
This all seems to work until the value of $cgi_vars($_) = "". In that case the value remained unchanged, so I did some testing with just 1 element...
## This worked if ($cgi_vars{fname}) { $q->param('fname' => $cgi_vars{fname}); } else { $q->param('fname' => ""); } ## But this did not $q->param('fname' => $cgi_vars{fname});
Could someone explain where I'm going astray? Or maybe there's a better way to deal with this
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using associate with HTML::Template
by Joost (Canon) on Apr 06, 2005 at 20:27 UTC | |
by nedals (Deacon) on Apr 06, 2005 at 22:12 UTC | |
by dragonchild (Archbishop) on Apr 07, 2005 at 00:24 UTC | |
|
Re: Using associate with HTML::Template
by Cody Pendant (Prior) on Apr 06, 2005 at 23:39 UTC | |
by nedals (Deacon) on Apr 07, 2005 at 18:04 UTC |