Hello all,
Been looking for a while for this answer, and seem to think it must
have been asked before, although both the archives mentioned in the
docs are down. So here goes:
Is there an easy way to pass a Hash to HTML::Template in hopes to use
the key/value pairs, without putting it in a <TMPL_LOOP>?
Along with HTML::Template, I'm also familiar with Template-Toolkit. It
had the dot syntax, where you can navigate a complex data structure
like -
$this->{that}->{then}->{some}
like this:
[% this.that.then.some %]
I can't find anything similar in HTML::Template, except to put a
<TMPL_LOOP> around the block of HTML when I want to access a value in a
hash. I guess this is fine with me - as long as performance isn't
completely dismal;
To clarify, in my Perl code, I have a hash that holds any errors that
may have been put forth from an HTML form. Something like:
my %errors = (forgot_name => 1, impossible_zipcode => 1,
is_the_unabomber => 0);
my theoretically HTML would be something like:
<TMPL_IF EXPR="errors.forgot_name == 1">
<p>You forgot your name!</p>
</TMPL_IF>
Thanks for your time!
justinSimoni.Artist
--
.: art http://justinsimoni.com
.: phone 720 436 7701
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
|