|Welcome to the Monastery|
Module configuration for user vs. developerby bibliophile (Parson)
|on May 31, 2006 at 14:42 UTC||Need Help??|
bibliophile has asked for the
wisdom of the Perl Monks concerning the following question:
Brethren and Sistern,
I find myself in a design quandry, and seek enlightenment...
I've built a database-abstraction-layer module for handling a particular industry-specific data type (bibliographic MARC records). This abstraction layer, of course, uses DBI under the hood.
I've built a few different modules that the abstraction layer would use to connect to different back-ends (MySQL, Postgres, flat files,...). These use DBD.
This is all so that an application can just say "save this horribly complicated binary data thingy" without worrying about it. It works really well.
Right now, I'm hard-coding into the abstraction layer which particular back-end interface to use. Eventually I'll have that pulled from a config file of some sort.
I've got a bazillion tests - abstraction layer and back-end modules.
But here's my question (finally!): Is there some standard way figuring out (at "make" time? Before then?) which back-end the user needs/wants? (eg: if they have both Postgres and MySQL installed, but only have rights to use one or the other).
The second part of this question is for me as a developer - I've got all of the various databases/data stores running, and want to have the "make / make test" run against all of them. Again, right now I manually change (in the abstraction layer) which backend gets used, wrap the unused back-end tests in skip blocks, and then re-run the make. Is there a better way? How would you do it?
Any help you could give would be... well... helpful. :-)
Update:Thanks, all, for your thoughts and your reasoning - it is much appreciated!
-- WARNING: You are logged into reality as root.