Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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.
dragonchild

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2020-10-26 15:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (251 votes). Check out past polls.

    Notices?