A recent survey of CPAN DBI connect colutions and an even more recent rehash of the subject prompts me to mention what I have found out with daily use of DBIx::Connect. One day someone came up to me and stated that I need to do processing across 7 new databases on the same mysql server. Ideally, a form of inheritance or defaulting would have kicked in and I should have been able to say : for all databases on this machine, use this username and password. But instead, I had to copy and paste the same uname and passwd 6 times and create a total of 7 labels.

I want to exemplify the weakness of DBIx::Connect. Let's say that you have a dev and production database:

[basic] user= postgres pass = <STDIN> dsn= dbi:Pg:dbname=mydb attr RaiseError = 0 attr PrintError = 0 attr Taint = 1 [dev_db] user = root pass = w00t! dsn = dbi:mysql:database=mysqldb;host=localhost attr RaiseError = 1 attr PrintError = 1

Once you are setup like that you can simply connect to the database you want via DBIx::Connect->to('dev_db');

But now imagine that you come back from a refreshing 2-week vacation in the Bahamas and dev_db now has 7 databases that you must process. With the current use of AppConfig as the underlying config module, there does not appear to be an easy way to create user and passdefaults for all databases at a certain host. So, you have to copy and paste the same user and password information for 7 new entries and anyone that has been programming is very leery of cutting and pasting anything --- there should always be some programmatic means of reuse, be it a subroutine or inheritance of a default or whatever.

When dragonchild says that he has lots and lots of machines to deal with, such defaulting and inheritance is important and it is why I must use Resources for any future version of database conection package that I develop. The author of this package is AWOL and I have upgraded it to pass the test suite on new versions of Perl and eliminated all warnings... I want to add in some DBI connection support and rename it Config::Resources so that more people looking for a config package can find it.

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


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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.