Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: same database problem

by pfaut (Priest)
on Jul 04, 2003 at 13:53 UTC ( #271476=note: print w/replies, xml ) Need Help??

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://271476]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2021-02-28 18:59 GMT
Find Nodes?
    Voting Booth?

    No recent polls found