Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Howdy,
I am just starting to refactor a moderate-sized CGI site (perhaps 80 scripts, typically 100-300 loc). A lot of the scripts use SQL to retrieve data via DBI. The actual SQL is typically stored in each individual CGI script. As you can imagine, certain queries are very common, and could easily be factored into a StandardQueries module.
My thinking is to replace a code fragment like this:
my $sql_get_username = ' SELECT USER_NAME FROM USERS WHERE USER_ID = ?'; my $sth_get_username = $dbh->prepare($sql);
With one like this instead:
use StandardQueries; my $sth = $dbh->prepare(StandardQueries::get_username);
I have three questions about this approach:
Any thoughts much appreciated!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Impact of module size
by Abigail-II (Bishop) on Sep 12, 2003 at 18:49 UTC | |
by dmitri (Priest) on Sep 12, 2003 at 20:54 UTC | |
|
Re: Impact of module size
by adrianh (Chancellor) on Sep 12, 2003 at 22:18 UTC | |
|
Re: Impact of module size
by simonm (Vicar) on Sep 12, 2003 at 21:25 UTC |