Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have used a perl module called Mysql in one of my scripts. It has been a number of years since I used the script, which mostly created tables etc. I was looking to install the module on a new host. However, I see that there are several modules named Mysql. I am not sure which one to get and from where. The usage for the module is simply

use Mysql;

Can anyone help me locate the exact module and let me know how to install it on my Cent OS system (I have root access)

Replies are listed 'Best First'.
Re: Mysql module
by fishmonger (Chaplain) on Jun 01, 2014 at 01:52 UTC

    Rather than trying to scavenge around for the Mysql module, which doesn't seem to be on cpan any longer, it would be better to use the DBI (Database independent interface for Perl) module along with DBD::mysql MySQL driver for the Perl5 Database Interface module.

    The DBI module is the De facto standard perl module for DB interaction. Even mysql/oracle recommends using those modules. http://dev.mysql.com/downloads/dbi.html

    EDIT:

    I did find the Msql/Mysql module on cpan but it hasn't been updated since 2001 and its documentation states the following.

    OBSOLETE SOFTWARE

    As of Msql-Mysql-modules 1.19_10 M(y)sqlPerl is no longer a separate module. Instead it is emulated using the DBI drivers. You are strongly encouraged to implement new code with DBI directly. See "COMPATIBILITY NOTES" below.

    DESCRIPTION ^

    This package is designed as close as possible to its C API counterpart. The manual that comes with mSQL or MySQL describes most things you need. Due to popular demand it was decided though, that this interface does not use StudlyCaps (see below).

    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.
      I did not realize the modules were that old. I will try to work with a more current module.
Re: Mysql module
by taint (Chaplain) on Jun 01, 2014 at 01:34 UTC
    Greetings.

    Generally speaking. The most recent version, is the one to choose. But, given there is little context to work with (nothing other than the use statement). It's difficult to determine if there might be any incompatibilities, where newer versions are concerned.

    Any chance you'd be willing to share more specifics, where the code you're working with, is concerned? Maybe the first 20 - 30 lines of the main script? What it's used for, {...}?

    Best wishes.

    --Chris

    ¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH

      I have attached a few lines of code
      $dbh = Mysql->connect($dbServerHost, $dbNameOnly, $dbUser, $db +Passwd); if (! $dbh) { return 0; } print "<br>...connected"; print "<br>Getting table structure..."; my $fields = $dbh->listfields($table);
      If it a very old module, I may need to use a more current module.

        Yea, you're working with MySQL, and a database. That was pretty much a given, after reading your first post. What we need to see, which would have been more telling. Was the first 20-30 lines of that script, which I indicated in my reply. Aren't you unable to post those lines?

        No offense. But you haven't posted enough information, to provide an intelligent response.

        We can't see the script you're working with. We haven't ever used the script you're working with, and, to the best of my knowledge. None of us are clairvoyant. ;)

        Please see How do I post a question effectively?, if you're at all unsure how best to respond.

        Best wishes.

        --Chris

        ¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH