Fellow Monasterians,
I thought I was doing this right, but.... I'm trying to make an AoH ref acceptable for an HMTL::Template loop. Here's the salient code:
my $allshows; for my $i ( 0 .. $#ids ) { $stmt = "SELECT id,title,teaser,number FROM shows WHERE id = '$ids[ +$i]'; &execute_it( $stmt ); #db operations to grab all matches push @$allshows, $sth->fetchall_arrayref({}); } $template = HTML::Template->new(filename => 'showslisting.tmpl'); $template -> param( showlist => $allshows );
Which gives me an error of
Single reference arg to param() must be a hash-ref!
I did try:
$template -> param( showlist => @$allshows );
But that gives me an error:
You gave me an odd number of parameters to param()
If it's helpful, Data Dumper returns this for my AoH:
$VAR1 = [ { 'id' => '6', 'teaser' => 'Domestic violence has been called a serious health crisis +.', 'title' => 'Battered and Broken', 'number' => '214' } ];
Thanks!
In reply to How to get an acceptable H::T AoH ref by bradcathey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |