Re: I updated DBD and broke some scripts

Patrick Galbraith <[email protected]> Tue, 04 Mar 2008 07:21:33 -0500
Newsgroups gmane.comp.db.mysql.perl
Message-ID <[email protected]>
John ORourke wrote:

> 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
>
>
The other option is you could use the old driver version. The old 
wrapper library didn't take advantage of any of the DBI features, so 
depending on your application, it may or may not make much difference.

You can get much more out of the new code if you use DBI however.

regards,

Patrick

-- 
Patrick Galbraith, Senior Programmer 
Grazr - Easy feed grazing and sharing
http://www.grazr.com 

Satyam Eva Jayate - Truth Alone Triumphs
Mundaka Upanishad




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