lpoht has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I haven't posted here in a while since I've been away from perl for a few months. Regardless, straight to the problem:
I have a sub which gets some information from a database and returns it (multiple rows) as an array of associative arrays. I want to stuff this array into another associative array which will be written to the template page in a TMPL_LOOP block.
$htmlparams{BROWSEDATA} = \&executesql($db,"SELECT ...",1); This code gets the array of database data and puts it in the associative array.
However when HTML::Template attempts to write the data to the page with the line of code $template->param(%htmlparams);, I get the following error message:
Uncaught exception from user code:
Can't call method "isa" on unblessed reference at C:/Perl/site/lib/HTML/Template.pm line 2364.
HTML::Template::param(undef, 'ID', 47, 'TITLE', 'sometitle', 'BROWSEDATA', 'SCALAR(0x321a8a8)') called at C:\Inetpub\CCProduction\cgi_bin\gallery\viewcomment.cgi line 130 I think that undef has something to do with the problem. Any ideas? Thanks.
Comment on Problems with unblessed references and HTML::Template
I'm pretty sure that first line doesn't do what you want it to. it is currently returning a reference to the value that executesql() returns. you probably meant