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


in reply to same database problem

One thing that might help you when debugging web applications is to make your code more modular. Create packages to handle different aspects of the program. Your entire database interface, for example, ought to be written as a separate module. And don't think being a separate module means writing OO code - it just means separating out a related set of subroutines into its own source.

If you do this, you will have a defined set of subroutines to talk to your database - this is the database interface. You will then be able to write test programs to call this interface and make sure it works before you try calling it from your web pages (which are extremely hard to debug).

Figure out what transactions you are performing against your database and write subroutines to perform those transactions. It sounds like you might need routines to add new messages, list messages, get a specific message, etc. Then, remove all database handling code from your web apps. They should collect submitted information, determine what needs to be done, and pass some or all of that collected information to one or more database routines to do the actual work.

90% of every Perl application is already written.
dragonchild