I apologize in advance for what I realize is a rather broad question, and one that is mostly Perl and not MySQL.
I've been writing Perl scripts for using MySQL databases on the Web. Paul DuBois' _MySQL and Perl for the Web_ has been enormously helpful to me, and most of my programs are based on things from this book. I'm at the point though where I have a number of applications that share large blocks of similar code, and I could use some advice on how to modularize this so I can avoid the huge hassles every time I make a change and then have to tweak a dozen similar applications. In some cases I have extremely similar structures--three separate libraries that have slightly different fields or field-names--and in other cases the designs are rather different. I've done what I can to write functional interfaces for very straightforward cases, so that the connection is handled by a function that is passed configuration info from a file accessed by Config::General, for example. I assume that I should start writing some OO modules, but I'm a little concerned since I've used, but never written, much OO code. I've looked at some of the CPAN modules, but nothing seems to be what I need; they're generally too fancy or designed to work with some more elaborate system. Some examples of the things that are giving me headaches: I'd like to be able to search across the three libraries in some easy manner; currently I've ended up just effectively rewriting the search routine for a fourth time, UNIONing the results. I have a pager routine in every program, that's identical but for a list of search parameters that can be passed for each page. It's annoying enough that I have to remember to change this list every time I change the form; having to change it for every program is that much worse. (I plan eventually to store this info in a server-side session.) The different libraries all have single-table structures, and I've unified some of the logic by putting the field names, desired form fields, etc. in a separate library that I can access from different scripts. But while this is convenient, it's not going to be possible to work when I add additional tables, which I'll need to do soon. I have extremely similar routines everywhere to generate the forms, and to parse and verify them, and to generate SQL queries from the results. Perhaps this can't be helped, as the forms have to be different, but it's getting clunky. The display routines, to generate HTML tables, are a total mess; if I want to change the order that fields display, or add fields (esp. dynamically), it's very difficult to do so. Also annoying is that each application tends to have several parts (an add, search, edit, delete, display_full, etc.), and there's a lot of shared code among the various routines. I'd like to get better interactivity among each branch of the overall application, without having to resort to the kludgy things I'm doing now. Thanks for any suggestions, or questions. I'd be happy to clarify anything or post code if required. Jesse Sheidlower -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]