in reply to Quick way to set up columns with Class::DBI ?

I don't recommend starting a new project with Class::DBI at this point unless your needs are very basic. You'd be better off using a more full-featured database mapping tool like Rose::DB::Object or DBIx::Class.
  • Comment on Re: Quick way to set up columns with Class::DBI ?

Replies are listed 'Best First'.
Re^2: Quick way to set up columns with Class::DBI ?
by jfrm (Monk) on Aug 18, 2006 at 23:21 UTC
    Wow. Having read up on those, looks like you have saved me a lot of hassle, thanks. Everytime I ask a question I get an suggestion that doesn't answer it but points me somewhere else better!

    Now I need to work out which is best for me. I've read some comparison discussions that seem to concentrate on things I'm not so fussed about like performance. However, I'm presently liking the look of Rose better for 2 reasons:
    1. the documentation seems larger and easier to understand
    2. It is obvious how to automatically configure the database which saves me a lot of time. It isn't clear to me that DBIx::Class even does this, does it?

    My objective is to create some generic routines that will simply generate web forms that will allow me to BREAD several disparate databases of mine. Does Rose sound good for this?

    Actually as I've got this far on the deep voyage of discovery I am undergoing this week, does anyone know of good packages to help me generate the web forms?

    As ever I am very grateful for all pointers and advice.
      DBIx::Class is also capable of auto-configuration from your database. Both will work for BREAD. There are some auto-BREAD/CRUD things for Catalyst that use DBIx::Class, but I haven't personally tried them.
        Thanks for this. Having had great difficulty trying to install Rose, I'm now having a look at DBIx class. But I was interested in your comment on Catalyst which I've seen mentioned in a variety of places. I've tried to read up on it and see that it is supposed to be good. However, I must confess to not understanding at all what it does. Is there anyone out there who can explain in almost layman's terms why it's useful and what it does?

        It looks rather complicated and big. Given that I just want to BREAD using HTML forms, is it worth enduring the learning curve? i.e. should I be using Catalyst or is this a sledgehammer to crack a nut?
      My objective is to create some generic routines that will simply generate web forms that will allow me to BREAD several disparate databases of mine. Does Rose sound good for this?

      It sure does :) Take a look at Rose::HTML::Objects as well for the form generation. It's pretty easy to auto-generate both things: the RDBO classes from the database (with the Loader/auto_initialize) and then auto-generate the HTML forms using something like what's described in this mailing list post. (Hop on the mailing lists for Rose::DB::Object and Rose::HTML::Objects if you have any questions.)

      (Whoops, link corrected.)

        Ooh. Ooh. Thanks. Yes, I do like the objects thing.

        Yes I already saw that it has a thriving and responsive community. I will start worshipping at the temple of the Rose. It has to be better than Class::DBI for starters because that refuses to install!<br
        Well I have to admit to be slightly disappointed. I have knocked on the door of the Rose::DB temple but it wasn't open. I did try to sneak in through a side door but the inner sanctum was locked... Or put another way, I have tried for quite some time now to install the Rose stuff; overcame a couple of problems but can't afford to spend more time, really. However, I would like to help so am offering this as a point of feedback more than anything else.

        First off, I tried PPM but Rose isn't in the AS repository (I'm beginning to see that I should regard this as a very bad omen because whenever a package isn't there, only rarely can i manage to install it via any other method....)

        Then I tried CPAN which fails because Datetime doesn't install due to a win32 buglet in the infinite tests. I did eventually get over this hurdle - the bug seems to be well known and apparently ignorable so I installed Datetime manually and then went back and tried to CPAN Rose again (I wasn't entirely sure if this was the right approach but it did seem to get further so I think it must have been). But then CPAN/Rose first told me that I needed to set environment variables allow connection to the DB in order to complete the tests but also said that if they weren't set the tests would be ignored. Unfortunately the tests didn't seem to work. Here is the output:

        t\00-warning.......................ok t\bind-param.......................Can't locate Rose/DB.pm in @INC (@I +NC contains: C:\.cpan\build\Rose-DB-Object-0.75\blib\lib C:\.cpan\bui +ld\Rose-DB-Objec t-0.75\blib\arch C:/PERL/lib C:/PERL/site/lib . C:/PERL/lib C:/PERL/si +te/lib .) at t/test-lib.pl line 7. BEGIN failed--compilation aborted at t/test-lib.pl line 7. Compilation failed in require at t\bind-param.t line 9. BEGIN failed--compilation aborted at t\bind-param.t line 11. t\bind-param.......................dubious Test returned status 2 (wstat 512, 0x200) DIED. FAILED tests 1-27 Failed 27/27 tests, 0.00% okay t\column-triggers..................Can't locate Rose/DB.pm in @INC (@I +NC contains: C:\.cpan\build\Rose-DB-Object-0.75\blib\lib C:\.cpan\bui +ld\Rose-DB-Objec t-0.75\blib\arch C:/PERL/lib C:/PERL/site/lib . C:/PERL/lib C:/PERL/si +te/lib .) at t/test-lib.pl line 7. BEGIN failed--compilation aborted at t/test-lib.pl line 7. Compilation failed in require at t\column-triggers.t line 9. BEGIN failed--compilation aborted at t\column-triggers.t line 13. t\column-triggers..................dubious Test returned status 2 (wstat 512, 0x200) DIED. FAILED tests 1-259 Failed 259/259 tests, 0.00% okay t\db-migration.....................Can't locate Rose/DB.pm in @INC (@I +NC contains: C:\.cpan\build\Rose-DB-Object-0.75\blib\lib C:\.cpan\bui +ld\Rose-DB-Objec t-0.75\blib\arch C:/PERL/lib C:/PERL/site/lib . C:/PERL/lib C:/PERL/si +te/lib .) at t/test-lib.pl line 7. BEGIN failed--compilation aborted at t/test-lib.pl line 7. Compilation failed in require at t\db-migration.t line 9. BEGIN failed--compilation aborted at t\db-migration.t line 11. t\db-migration.....................dubious Test returned status 2 (wstat 512, 0x200) DIED. FAILED tests 1-33 Failed 33/33 tests, 0.00% okay t\db-object-auto...................Can't locate Rose/DB.pm in @INC (@I +NC contains: C:\.cpan\build\Rose-DB-Object-0.75\blib\lib C:\.cpan\bui +ld\Rose-DB-Objec t-0.75\blib\arch C:/PERL/lib C:/PERL/site/lib . C:/PERL/lib C:/PERL/si +te/lib .) at t/test-lib.pl line 7. BEGIN failed--compilation aborted at t/test-lib.pl line 7. Compilation failed in require at t\db-object-auto.t line 9. BEGIN failed--compilation aborted at t\db-object-auto.t line 12. t\db-object-auto...................dubious Test returned status 2 (wstat 512, 0x200) DIED. FAILED tests 1-266 Failed 266/266 tests, 0.00% okay
        --snip-- and so it goes on... --snip--
        Test returned status 2 (wstat 512, 0x200) DIED. FAILED tests 1-7 Failed 7/7 tests, 0.00% okay t\spot-check-09....................Can't locate Rose/DB.pm in @INC (@I +NC contains: C:\.cpan\build\Rose-DB-Object-0.75\blib\lib C:\.cpan\bui +ld\Rose-DB-Objec t-0.75\blib\arch C:/PERL/lib C:/PERL/site/lib . C:/PERL/lib C:/PERL/si +te/lib .) at t/test-lib.pl line 7. BEGIN failed--compilation aborted at t/test-lib.pl line 7. Compilation failed in require at t\spot-check-09.t line 9. BEGIN failed--compilation aborted at t\spot-check-09.t line 11. t\spot-check-09....................dubious Test returned status 2 (wstat 512, 0x200) DIED. FAILED tests 1-13 Failed 13/13 tests, 0.00% okay Failed Test Stat Wstat Total Fail List of Faile +d ---------------------------------------------------------------------- +--------- t\bind-param.t 2 512 27 54 1-27 t\column-triggers.t 2 512 259 518 1-259 t\db-migration.t 2 512 33 66 1-33 t\db-object-auto.t 2 512 266 532 1-266 t\db-object-cached.t 2 512 415 830 1-415 t\db-object-changes-only-1.t 2 512 483 966 1-483 t\db-object-changes-only-2.t 2 512 286 572 1-286 t\db-object-convention.t 2 512 159 318 1-159 t\db-object-foreign-key-auto.t 2 512 261 522 1-261 t\db-object-foreign-key.t 2 512 196 392 1-196 t\db-object-helpers.t 2 512 298 596 1-298 t\db-object-loader-2.t 2 512 86 172 1-86 t\db-object-loader-3.t 2 512 61 122 1-61 t\db-object-loader-4.t 2 512 86 172 1-86 t\db-object-loader-5.t 2 512 101 202 1-101 t\db-object-loader-6.t 2 512 96 192 1-96 t\db-object-loader.t 2 512 120 240 1-120 t\db-object-manager-bulk-ops.t 2 512 218 436 1-218 t\db-object-manager.t 2 512 2939 5878 1-2939 t\db-object-mapper.t 2 512 315 630 1-315 t\db-object-metadata.t 2 512 28 56 1-28 t\db-object-relationship-auto-2.t 2 512 92 184 1-92 t\db-object-relationship-auto.t 2 512 92 184 1-92 t\db-object-relationship.t 2 512 1478 2956 1-1478 t\db-object-std-cached.t 2 512 241 482 1-241 t\db-object-std.t 2 512 185 370 1-185 t\db-object.t 2 512 468 936 1-468 t\deep-joins.t 2 512 1496 2992 1-1496 t\inheritance.t 2 512 55 110 1-55 t\lazy-columns.t 2 512 80 160 1-80 t\make-modules.t 2 512 ?? ?? ?? t\makemethods-db.t 2 512 51 102 1-51 t\makemethods.t 2 512 125 250 1-125 t\multi-pk-sequences.t 2 512 50 100 1-50 t\query-builder.t 2 512 2 4 1-2 t\save-cascade.t 2 512 89 178 1-89 t\schema-override.t 2 512 8 16 1-8 t\spot-check-01.t 2 512 82 164 1-82 t\spot-check-02.t 2 512 32 64 1-32 t\spot-check-03.t 255 65280 4 7 1-4 t\spot-check-04.t 2 512 6 12 1-6 t\spot-check-05.t 2 512 3 6 1-3 t\spot-check-06.t 2 512 5 10 1-5 t\spot-check-07.t 2 512 4 8 1-4 t\spot-check-08.t 2 512 7 14 1-7 t\spot-check-09.t 2 512 13 26 1-13 1 test skipped. Failed 46/48 test scripts. 11401/11402 subtests failed. Files=48, Tests=11402, 21 wallclock secs ( 0.00 cusr + 0.00 csys = 0 +.00 CPU) Failed 46/48 test programs. 11401/11402 subtests failed. NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code + '0x2' Stop. C:\indigoperl\bin\nmake.EXE test -- NOT OK Running make install make test had returned bad status, won't install without force
        I'm not sure if it failed due to lack of env. variables in which case instructions seemed to mislead me or otherwise. Anyway, then I was rather cheesed off and discovered that PPM installed DBIx instantly and without a murmur. So I think I'll try to pray at the DBIx temple and see if that leads me to enlightenment for now...