http://www.perlmonks.org?node_id=351714


in reply to AoH refs for setting HTML::Template loops

Where is the data? What does it look like? Why are you splitting data retrieved from a database? Why didn't you design your database to handle this instead? Why are you calling the subroutine execute_it with no arguments? And why aren't you using Data::Dumper for debugging your data structures?

So many problems bradcathey. Try this instead: (untested)

use DBI; use HTML::Template; use Data::Dumper; my $dbh = DBI->connect( qw(DBI:vendor:database:host user pass), {RaiseError => 1}, ); my $username = 'jeffa'; my $branches = $dbh->selectall_arrayref( 'SELECT branches FROM users WHERE username = ?', {Slice => {}}, $username, ); warn Dumper $branches; my $tmpl = HTML::Template->new(filehandle => \*DATA); $tmpl->param(branches => $branches); print $tmpl->output; __DATA__ <tmpl_loop branches> <tmpl_var branches> </tmpl_loop>
and let me know how it goes. :)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)