How can I display DBM entries in an HTML table? (Revised)by bladx (Chaplain)
|on Dec 29, 2001 at 09:26 UTC||Need Help??|
bladx has asked for the
wisdom of the Perl Monks concerning the following question:
This is the revised question and code, many thanks go to jepri for all the changes, and the obvious mistake I made (didn't use strict;) anyways, on to the real question, but first a little background. I am creating a simple news database program that saves to a DBM style database, and can add entries into it, using hashes. I am also using HTML::Template for the first real time to seperate the code from the HTML. My question is, how can I have this code snippet display all of the database entries in a table? Also a second question I have about implementing this type of code, is: how can I display all the entries in a form where each of the contents of each hash row is seperated ... like by using split? Thanks for any help! note:I have not added the file lock yet, but that will be added before I actually use this code in a bigger project later. I am sure that there is a lot of the program that could be much more efficient than it is, if so, please let me know, so I can learn and fix it! Thanks again.
Here is the first file, the actual code file (news.pl):
And here is the HTML Template file for the code (news.tmpl):
That should be all you need to check this program. By the way, this is not a homework question, this is a question that I would like to figure out how to do this sort of program correctly, because last summer I created a web framework news type of thing, but it sucked, and I am hoping this will be better overall than my last project. The old project's site page is at www.hashes.f2s.com ... but it is terrible ^_- so don't see it.