Perl: the Markov chain saw | |
PerlMonks |
Re: Testing & Databasesby blue_cowdawg (Monsignor) |
on Jan 28, 2004 at 13:57 UTC ( [id://324669]=note: print w/replies, xml ) | Need Help?? |
There are as many ways of skinning that cat as there are folks trying to skin it. Here are some of the aproaches I've seen without passing judgement on any of them.
Environmental valuesAs you pointed out you an always use your environmental values to drive your application's behavior. You showed one way, but here's an alternative:The above ripped from some code I'm maintaining. The actual values changed to protect the guilty.
Configuration FilesThere are two general methods I've seen for doing this. One uses an external configuration file that you either parse yourself or you can use one of several AppConfig family of CPAN modules to do your dirty work.The other method I've seen (and used myself) is to create your own module that encapsulates your database access configuration. The one I use over and over again I call (oddly enough) DbConfig.
When I install DBConfig on my production boxes I make the appropriate changes to the module. Otherwise the code is identical. As always in Perl TIMTOWTDI!
In Section
Seekers of Perl Wisdom
|
|