Don't ask to ask, just ask | |
PerlMonks |
Re: Re-Factoring: Philosophy and Approachby mpeppler (Vicar) |
on Nov 02, 2001 at 23:43 UTC ( [id://122899]=note: print w/replies, xml ) | Need Help?? |
Just a few thoughts regarding the DBI code... Try to create logical database requests, wrap those in perl subroutines, and place them in a separate module. This will greatly improve the readability of the main script, and will also improve maintainability. Avoid "select * ..." SQL statements. Be explicit in what you are querying, even if that makes the code more verbose - it'll again improve maintainability. One thing that is repeating a lot in the code is prepare/execute/fetch one row. Maybe you could use a utility subroutine that does that, something like:
Just using that could already simplify the code to a great extent. Michael
In Section
Seekers of Perl Wisdom
|
|