SPUG: Best practice? DBI connection parameters *not* in Perl code
Skylos
skylos at gmail.com
Thu Apr 8 10:53:01 PDT 2010
I'm not entirely sure if its best practice, but my feeling is that I would
prefer a config file because its a more obvious artifact that can be
deployed with the application. As for format, YAML of course. And here's a
module especial for that.
http://search.cpan.org/~moconnor/YAML-AppConfig-0.16/lib/YAML/AppConfig.pm
Skylos
On Thu, Apr 8, 2010 at 10:45 AM, Michael R. Wolf <MichaelRWolf at att.net>wrote:
> As some DBI-based code is being ported to other machines, I'm having to
> pass command-line parameters to too many administrative and test programs.
> I'd like to change this *once* external to *all* programs and have it apply
> to them all. This will have the added benefit of articulating a cleaner
> differentiation between environments (development, test, production).
>
> What's more popular to do this?
> - environment variables
> - config file
>
> In code, and in *theory*, it's a trivial difference...
>
> $db_user = $ENV{db_user} || 'root';
> versus
> $db_user = $some_config_ref->get_attribute('db_user') || 'root';
>
> I'm more interested in how this works in *practice*. That is, when
> fielded, which seems to be groked by more end users? And if the answer is
> 'config', which of the 2 score and twenty config modules seems to be groked
> by more end users?
>
> Thanks,
> Michael
>
> --
>
--
"If only I could get rid of hunger by rubbing my belly" - Diogenes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/spug-list/attachments/20100408/e9cfa9cc/attachment.html>
More information about the spug-list
mailing list