You will get that error alot as you go along, especially if you "use strict". You just need to tightenup the code. You don't give much code to go on, so I would guess that $sql_query or $dbh hasn't been initialized yet. Try putting
I initialized $sql_query & $dbh, but it doesn't help me. The following below is a print of $sql_query and the message that is being generated when one clicks on first column:
select cdate AS 'Creation Date/Time',
case
when statusType = '1' then 'Debug'
when statusType = '2' then 'Info'
when statusType = '3' then 'Warning'
when statusType = '4' then 'Error'
else 'unknown'
end as Status,
statusValue AS 'Description'
from statusmessages
order by cdate desc LIMIT 100
Use of uninitialized value in string eq at E:/Perl/site/lib/Tk/DBI/Table.pm line
294.
Use of uninitialized value in string eq at E:/Perl/site/lib/Tk/DBI/Table.pm line
294.
Use of uninitialized value in string eq at E:/Perl/site/lib/Tk/DBI/Table.pm line
294.
Use of uninitialized value in string eq at E:/Perl/site/lib/Tk/DBI/Table.pm line
294.
Note that the message is being generated 4 times -> I click only 1 time...
Well I can barely feel my way around DBI stuff myself, and I've never used Tk::DBI::Table, so I really can't say what the glitch is. Maybe someone else knows. All I can tell you to do is this: try to get the simplest example possible which works the way you want. Then start adding the extras into it, until it fails, then try to sort out the reason. So maybe try a very simple $sql_query statement, and see if you
can get it to work, like "select * from statusmessages" or whatever is the simplest. You probably have some syntax error in the $sql_query.
Tk::DBI::Table assumes the first column in a select statement is the id column, and when I select a date/time column as the first column (as you have), I get this error before the table shows up:
parent element "1980-01-01 00:00:00" does not exist at C:/Perl/site/li
+b/Tk.pm li
ne 247.
at C:/Perl/site/lib/Tk/Derived.pm line 469
This is with Tk 800.24, Tk::DBI::Table 0.02, perl 5.8.4 (AS build 810).
Update: After some mucking about, I found that the "." in the date/time string was messing up the $hlist->add($entryPath) method (the date/time being used as the entry path for the HList). The "." is truncatated from the string in the error message, because "." is the default path 'separator' for an HList.