in reply to Re: Abstracting Class::DBI Database Connection Data
in thread Abstracting Class::DBI Database Connection Data
Greetings hardburn,
I have. Many times. But apparently I'm not smart enough to figure it out. This works:
package MyCDBI; use base 'Class::DBI::mysql'; __PACKAGE__->connection('dbi:mysql:mydb', 'me', 'mypwd');
But this doesn't:
package MyCDBI; use base 'Class::DBI::mysql'; sub db_Main { use DBI; return DBI->connect('dbi:mysql:mydb', 'me', 'mypwd') or die DBI->errstr; }
I get the nice error message: Can't locate object "fetch_hash" via package "DBI::st" at Class/DBI/mysql.pm line 65. The calling script only uses MyCDBI and prints a hello world, so there's nothing from that that's causing this. Any suggestions?
gryphon
code('Perl') || die;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Abstracting Class::DBI Database Connection Data
by dcvr69 (Beadle) on Jun 08, 2004 at 22:20 UTC | |
by gryphon (Abbot) on Jun 08, 2004 at 22:44 UTC | |
by perrin (Chancellor) on Jun 09, 2004 at 00:16 UTC | |
by gryphon (Abbot) on Jun 09, 2004 at 03:13 UTC | |
by perrin (Chancellor) on Jun 09, 2004 at 03:59 UTC |
In Section
Seekers of Perl Wisdom