My feedback about whether you should: Hells yeah!

On a more sober note: If your DB layout is clean then you definitely should. If your data is messy and the sort of stuff that makes DB admins cringe then maybe not. Over the years the *only* things I have seen go on the mailing list with no good answers were because the underlying data design was fscked and something designed for clean, correct data design like DBIC just isn't set up to meet it in the middle.

There is much more to be gained that simple object abstraction of a row. There's inflation, deflation, serialization, automatic adjunct/auxiliary data generation, validation, schema versioning, x-platform deployment, automatic fixtures, testing, resultset chaining, and more.

To do legacy stuff: I'd auto-generate a DBIC schema (Result:: and ResultSet:: namespaces, which isn't in all the docs because it's pretty new but it rules). Then just give new code a shot via the new DBIC schema. Setting it up is trivial; here's a semi-tested snippet-

use DBIx::Class::Schema::Loader "make_schema_at"; die "Give DB connection args! E.g.:\n", " dbi:mysql:someTable user password \n", " 'dbi:mysql:moo_moo;mysql_read_default_file=~/.my.cnf'\ +n" unless @ARGV; $ARGV[3] = { quote_char => "`" }; # Useful tidbit not (obvious) in the + docs. make_schema_at( $insert_schema_class, { components => [qw( SomethingYouUse )], quote_char => "`", dump_directory => $target_lib, use_namespaces => 1, }, \@ARGV );

Then go with it for the next little something-something and see if it's fun or a drag. :)


In reply to Re: Switch from DBI to DBIx::Class: thoughts? by Your Mother
in thread Switch from DBI to DBIx::Class: thoughts? by frew

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.