http://qs321.pair.com?node_id=206344

spork has asked for the wisdom of the Perl Monks concerning the following question:

I can't figure out what I am doing wrong and so I turn to the monks....

I have a function (see below) that prepares and calls the results of a SQL SELECT for an HTML::Template TMPL_LOOP. The function passes the SQL statement to another function which does the database lookup and returns an array of hashes (each column = 1 hash key). The function below refines the data a bit more (resolves table references into something more understandable for humans) and passes the refined array of hash references onto HTML::Template.

For some strange reason the assignment of the array to the appropriate TMPL_LOOP gives me a 500 error (notated in the code as the line that give me angst). If I comment out this line the page is served without issue (albeit without the results of the SELECT statement).

I put in some diagnostics to make sure there weren't any problems with the array of hash refs just before the assignment and all looked fine. I successfully use TMPL_LOOP in several places throughout my entire script and the syntax is the same everywhere, but this is the only place it seems to be broken.

NOTES: GetListFromDB does the SQL calls and returns the original array of hashes and GetItemFromDB resolves coded entries to strings. If it would help to see them let me know and I will post them. Thank you

I await absolution....

sub ShowLibLog { my $SQL = 'SELECT LibID, UID, ActionID, TXDate, Time, DocName, FromHos +t FROM LibrarianLog'; + my @log = GetListFromDB($SQL); my $item; my @liblog; foreach $item (@log) { # GetListFromDB will store the results of the sql statement in an arra +y of hash # references. Our first step is to create an array of hashes to be pa +ssed to # HTML::Template for display based on the results of the SQL statement +. *PHEW* my %entry = (LibID=>%$item->{'LibID'}, UID=>GetItemFromDB('RealName','UID', %$item->{'UID'},'User'), ActionID=>GetItemFromDB('ActionName','ActionID', %$item->{'ActionID'},'Action'), TXDate=>%$item->{'TXDate'}, Time=>%$item->{'Time'}, DocName=>%$item->{'DocName'}, FromHost=>%$item->{'FromHost'}); push (@liblog, \%entry); } $viewliblog_page->param(liblog=>\@liblog); #This is the line giving me + angst!!! print "Content-type: text/html\n\n", $viewliblog_page->output; }