There's more than one way to do things | |
PerlMonks |
Re: Nesting <TMPL_LOOP> in HTML::Templateby jepri (Parson) |
on Aug 28, 2002 at 11:40 UTC ( [id://193422]=note: print w/replies, xml ) | Need Help?? |
This is an excerpt from some production code that I turned out while I was still learning Perl. It could be shorter, but you can see what is happening. To access the inner loop variables, they have to be set as references stored in keys stored in a hash stored in the array that the outer loop is iterating over. You can do it without the hash in the middle, but if you do that you have nowhere to store things like data about the row that can be accessed in the outer loop. If that is a little hard to follow, I can recommend you do it the same way I did: build a little test CGI where you build the data structure by hand and get it working with HTML::Template first. The upside is that you will really, really know your perlrefs at the end of this.
I almost feel sorry for the maintenance programmer. ____________________
In Section
Seekers of Perl Wisdom
|
|