Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I've been using Class::DBI and decided to try Class::DBI::Loader.

Unfortunately I get an error even when I've reduced my code to a minimum, which is almost a duplicate of example the documentation:

package MyCompany::MyProduct::Database; use Class::DBI::Loader; my $loader = Class::DBI::Loader->new( dsn => "dbi:mysql:databasename", user => "username", password => "password", namespace => 'MyCompany::MyProduct::Database', relationships => 1); 1;
I am then using this module from a simple script which only tries to retrieve something from one of the tables.

This gives me the error 'Can't locate object method "set_db"' for the first table (alphabetically) in my database. It's obviously not inheriting correctly from Class::DBI somewhere along the line, but adding Class::DBI as a base does not solve the problem.

By adding Class::DBI to @ISA in Class::DBI::Loader::Generic's _load_classes routine I can force my way past the problem just long enough to get hung up on a call to set_up_table(). Clearly there are also other things the author wanted.

I don't see this problem listed in open bugs for Class::DBI::Loader and I find it difficult to imagine that I'd be the first one to find it. Therefore I hope perhaps someone can point me to what I'm doing wrong. I've read related nodes on the subject, such as this one, but that didn't seem to provide the answer.

I am using Perl 5.8.5, Class::DBI::Loader version 0.18, and Class::DBI version 0.96.

Thank you.


In reply to Class::DBI::Loader error: Can't locate object method "set_db" by kudra

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2021-12-02 03:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (16 votes). Check out past polls.

    Notices?