in reply to I swim in a sea of databases and DBIx::Connect is barely adequate

It seems to me that you are creating this problem yourself by using AppConfig. You should either extend AppConfig to support inheritance between sections, or use something else. For example, I would do something like this:

my %db_common = ( user => 'a', pass => 'b', host => 'c', database => 'd', ); my %db_foo = ( %db_common, database => 'e' ); my %db_bar = ( %db_common, database => 'f' );
  • Comment on Re: I swim in a sea of databases and DBIx::Connect is barely adequate
  • Download Code

Replies are listed 'Best First'.
Re: Re: I swim in a sea of databases and DBIx::Connect is barely adequate
by princepawn (Parson) on Oct 20, 2003 at 23:49 UTC
    Having reflected on your comments for several days, I have realized the following:
    1. I was hoping to have all means of facilitating database connections doable in configuration, not application. This is the mantra and motivation for Net::FTP::Common.
    2. I believe the keyword in your above comments is extend. If DBIx::Connect is properly designed then there should be someway to subclass it with Local::DBIx::Connectso that the assorted functions which retrieve connection information and use it to mske dbhs can be specialized for the specifics of my current work domain.

      This is not a bad option at all... I just need to look into my API (which has no documentation on subclassing) and

      1. document the means of subclassing and its motivation and
      2. make sure that it can be done easily via AppConfig

    Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality.

      I think you can do it all just by switching config modules. If you use Config::ApacheFormat, for example, you can have defaults and override them:
      # default user postgres pass <STDIN> dsn dbi:Pg:dbname=mydb attr RaiseError=0 attr PrintError=0 attr Taint=1 <Database dev_db> user root # the rest is inherited from defaults </Database>
        That's a pretty nice module... it will work. I am planning to upload my version of Config::Resources with warnings cleaned out, etc, etc. Then I will ruminate on the comparative approaches to defaulting argumements. Thanks for the pointer.

        Interesting how tregar did not submit patches to either author of preceding modules...

        Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality.