rlb3 has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

I'm trying to use CDL with this configuration:

my $loader = Class::DBI::Loader->new( dsn => "dbi:mysql:keyshop:127.0.0.1", user => "user", password => "pass", namespace => "Data", debug => 1, );
When I run the script I get:
Couldn't require loader class "Class::DBI::Loader::mysql", "Can't loca +te object method "set_sql" via package "Class::DBI::mysql" at /usr/lib/perl5/vendor_perl/5.8.7/Class/DBI/mysql.pm line 58. Compilation failed in require at /usr/lib/perl5/vendor_perl/5.8.8/Class/DBI/Loader/mysql.pm line 8. Compilation failed in require at (eval 3) line 2. BEGIN failed--compilation aborted at (eval 3) line 2. " at /usr/lib/perl5/vendor_perl/5.8.8/Class/DBI/Loader.pm line 81.

I'm not sure what's wrong. This works on Class::DBI::Loader version 0.22. I did find a ticket on rt.cpan.org that said this error is the result of not having the Class::DBI::mysql installed, but I do have it installed. I have reinstalled it to be sure.

Replies are listed 'Best First'.
Re: Class::DBI::Loader problems
by gellyfish (Monsignor) on Apr 12, 2006 at 16:25 UTC

    set_sql() is defined in Ima::DBI and over-ridden in Class::DBI, I would imagine you have an elderly version of one of those modules.

    /J\

Re: Class::DBI::Loader problems
by Corion (Patriarch) on Apr 12, 2006 at 16:07 UTC

      Thanks, but that wasn't it. I do have Class::DBI::Loader::mysql installed. I just now tried to reinstall it, and I get the same message.

Re: Class::DBI::Loader problems
by Herkum (Parson) on Apr 12, 2006 at 16:26 UTC

    If you notice, there is a a problem with the vendor supplied version of Class::DBI::Loader::Mysql, it is complaining becuase it cannot compile it for some reason.

    Compilation failed in require at /usr/lib/perl5/vendor_perl/5.8.8/Class/DBI/Loader/mysql.pm line 8.

    You can try moving that module (rename it with .old tacked on the end of it) and then reinstalling the via CPAN. There might be other issues that you don't know about with other modules though; you will not find out until you try.

      I've tried all of the suggestions but no dice. Here are a few things I've noticed because of your questions.

      If I type perl -MClass::DBI::Loader::mysql -e 1 I get:

      Can't locate object method "set_sql" via package "Class::DBI::mysql" a +t /usr/lib/perl5/site_perl/5.8.8/Class/DBI/mysql.pm line 58. Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/Class/ +DBI/Loader/mysql.pm line 8. Compilation failed in require. BEGIN failed--compilation aborted.

      And if I type perl -MClass::DBI::mysql -e 1 I get no errors at all. I've even reinstalled DBD::mysql. I appreciate all the help I have recived so far.

        I find this very very odd, but try adding a 'use Class::DBI;' call in the main script that you are calling Class::DBI::Loader from.

        From what I can tell, Class::DBI::mysql's call to use base 'Class::DBI' isn't use()ing Class::DBI at all -- but I thought use base was anologous to use()ing the module and then setting @ISA appropriately.

        I might just release a new Class-DBI-Loader distro with a use Class::DBI call up front

        If you are using CPAN or PPM, you can trying seeing a report of updatable modules. Maybe you can see if there are some Class::DBI modules that can be "updated".