Re: I updated DBD and broke some scripts

John ORourke <[email protected]> Mon, 03 Mar 2008 09:06:16 +0000
Newsgroups gmane.comp.db.mysql.perl
Message-ID <[email protected]>
J. wrote:
> ... then I changed the USE line to "use DBD::mysql;" and now I'm getting this error:
>
> Can't locate object method "connect" via package "mysql" (perhaps you forgot to load "mysql"?) at
> LIBR.pm line 84.
>   
You've updated the 'use' line but your script is still trying to call 
mysql->connect() - you need to use the DBI->connect(...) form - see the 
DBI man page for more info.  You'll probably want 'use DBI' instead of 
'use DBD::mysql' - the mysql module is pulled in automatically when you 
tell it to connect to a mysql database.

> "As of March 1998, the Msql and Mysql modules are obsoleted by the DBI drivers DBD::mSQL and
> DBD::mysql, respectively. You are strongly encouraged to implement new code with the DBI drivers.
>   

If you're using an interface that was obsoleted 10 years ago, the only 
option is to rewrite your code!  I should be a fairly straightforward 
change, and the DBI interface is nice and easy to use.

John


-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/[email protected]