I can save all my template variables in an array, then pass that array over to the template and somehow (don't know how yet) I can then "extract" them into individual items I can use? Did I get that right?Not quite, you can pass it a hash reference, if you want to fill in several TMPL_VAR's you can do this:
So you can build a HASH and pass in a reference. Oh. lets not forget, in CGI the Vars method will return either a HASH of a HASHREF of all the parameters, instead of iterating over them using the param method you can get then in one bite. If you use$template->param( 'username' => 'john', 'userstatus' => 'paid' );
then you get a tied HASHREF which you can pass to H::T.$hashref = $q->Vars;
will set all the variables for which a hash key exists. In this case <TMPL_VAR name="username"> and <TMPL_VAR name="userstatus">.$template->param( $hashref );
Interestingly, H::T can also accept an object with a param method, similar to CGI. Well, this then means that you should be able to pass the query object to H::T, I havn't tried it, but it should work.
$template->param( associate => $q );
HTML::Template is immensely flexible and can be used in many ways, and it can be fed in many and various ways too!
In reply to Re: Re: Re: HTML::Template, CGI, pass template params to next script
by jdtoronto
in thread HTML::Template, CGI, pass template params to next script
by Lori713
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |