First, thanks for your responses and explanations. I admit I burst into laughter when I read #6... the idea that I might roll my own when I can barely read and understand any POD... <giggle> I just wish it were even possible to roll my own at this stage! ;-)
I've been trying to play with CGI::Session, but I can't get it to work for me. I don't know if it's because I'm trying to save ALL my CGI form variables PLUS my TMPL_VAR variables... Is that even possible? As for CGI.pm, wouldn't CGI.pm's "stickyness" be the default behavior? I see where there's a pragma called "-nosticky". I can't seem to pass the variables to the second script, even though I successfully passed them to the first script (and I suspect it's because the variables were in a form and CGI.pm likes that). So, am I correct in my understanding that CGI.pm won't pass the form variables a second time because there's no form?
edited: left the following question out...
Now, on to item #2... that's intriguing. I'd like to make sure I understand what you're saying. 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?
Thanks!
| [reply] |
| [reply] [d/l] [select] |
I missed part of your questions:
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:
$template->param( 'username' => 'john',
'userstatus' => 'paid' );
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 $hashref = $q->Vars;
then you get a tied HASHREF which you can pass to H::T. $template->param( $hashref );
will set all the variables for which a hash key exists. In this case <TMPL_VAR name="username"> and <TMPL_VAR name="userstatus">.
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!
jdtoronto | [reply] [d/l] [select] |