I updated DBD and broke some scripts

I updated DBD and broke some scripts

am 03.03.2008 09:49:13 von sweepingoar

Hi everyone,

I've been using a group of perl scripts since 1997 or so to maintain a small database. Recently I
ran a system update and DBD, DBI and Perl got updated to newer versions (DBD to 4.00.5 and DBI to
1.601) and now I'm having trouble running my scripts. It seems that the "USE Mysql;" is no longer
valid and the new "USE mysql;" doesn't have the same interface that the scripts use. The way the
scripts work is that a db object is created once when the script runs and queries are sent using
the syntax:

$results = $databaseObject->query( "SELECT something from some_tables );

at first I was getting this error:

Can't locate mysql.pm in @INC (@INC contains: /etc/perl
/usr/lib/perl5/vendor_perl/5.8.8/i686-linux /usr/lib/perl5/vendor_perl/5.8.8
/usr/lib/perl5/vendor_perl /usr/lib/perl5/site_perl/5.8.8/i686-linux
/usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/5.8.8/i686-linux
/usr/lib/perl5/5.8.8 /usr/local/lib/site_perl .) at LIBR.pm line 8.
BEGIN failed--compilation aborted at LIBR.pm line 8.
Compilation failed in require at ./update.pl line 3.
BEGIN failed--compilation aborted at ./update.pl line 3.

.... 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.

Someone on my distribution's forum pointed this out from CPAN:

"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.
In fact, Msql and Mysql are currently implemented as emulations on top of the DBI drivers."

and suggested that possibly the emulation has finally been removed. Can anyone shed a little more
light or offer some suggestion on a way I can keep using my scripts running without rewriting them
all to use different functions/interfaces? Thanks.

-Jason


____________________________________________________________ ________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: I updated DBD and broke some scripts

am 03.03.2008 10:06:16 von John ORourke

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/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

RE: I updated DBD and broke some scripts

am 03.03.2008 10:09:43 von gonchi

Hi,

I had problems like this with old scripts, the interface Mysql doesn't exis=
t yet in the new perl version. You must use DBI::mysql , also you must chan=
ge part of the code, the new interface is different, connect and query call=
s are different. You can try to install the old Mysql-Msql interface but is=
not recommended.

-----Original Message-----
From: J. [mailto:sweepingoar@yahoo.com]
Sent: Monday, March 03, 2008 10:49 AM
To: perl@lists.mysql.com
Subject: I updated DBD and broke some scripts

Hi everyone,

I've been using a group of perl scripts since 1997 or so to maintain a smal=
l database. Recently I
ran a system update and DBD, DBI and Perl got updated to newer versions (DB=
D to 4.00.5 and DBI to
1.601) and now I'm having trouble running my scripts. It seems that the "US=
E Mysql;" is no longer
valid and the new "USE mysql;" doesn't have the same interface that the scr=
ipts use. The way the
scripts work is that a db object is created once when the script runs and q=
ueries are sent using
the syntax:

$results =3D $databaseObject->query( "SELECT something from some_tables );

at first I was getting this error:

Can't locate mysql.pm in @INC (@INC contains: /etc/perl
/usr/lib/perl5/vendor_perl/5.8.8/i686-linux /usr/lib/perl5/vendor_perl/5.8.=
8
/usr/lib/perl5/vendor_perl /usr/lib/perl5/site_perl/5.8.8/i686-linux
/usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/5.8.=
8/i686-linux
/usr/lib/perl5/5.8.8 /usr/local/lib/site_perl .) at LIBR.pm line 8.
BEGIN failed--compilation aborted at LIBR.pm line 8.
Compilation failed in require at ./update.pl line 3.
BEGIN failed--compilation aborted at ./update.pl line 3.

.... then I changed the USE line to "use DBD::mysql;" and now I'm getting th=
is error:

Can't locate object method "connect" via package "mysql" (perhaps you forgo=
t to load "mysql"?) at
LIBR.pm line 84.

Someone on my distribution's forum pointed this out from CPAN:

"As of March 1998, the Msql and Mysql modules are obsoleted by the DBI driv=
ers DBD::mSQL and
DBD::mysql, respectively. You are strongly encouraged to implement new code=
with the DBI drivers.
In fact, Msql and Mysql are currently implemented as emulations on top of t=
he DBI drivers."

and suggested that possibly the emulation has finally been removed. Can any=
one shed a little more
light or offer some suggestion on a way I can keep using my scripts running=
without rewriting them
all to use different functions/interfaces? Thanks.

-Jason


____________________________________________________________ _________=
_______________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=
=3DAhu06i62sR8HDtDypao8Wcj9tAcJ


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=3Dyairl@savion.huji.ac=
..il


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=3Dgcdmp-msql-mysql-modules @m.gmane.org

Re: I updated DBD and broke some scripts

am 04.03.2008 13:21:33 von Patrick Galbraith

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/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: I updated DBD and broke some scripts

am 04.03.2008 21:38:37 von sweepingoar

Thanks Patrick. I've already started rewriting the code. It's tedious, but not terrible or
difficult at all (so far at least).

--- Patrick Galbraith wrote:

> 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/perl?unsub=sweepingoar@yahoo.com
>
>



____________________________________________________________ ________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?categor y=shopping

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org