Perl and mysql

matrixfan0831

Limp Gawd
Joined
Jul 30, 2004
Messages
276
Hi everyone,
I recently installed mysql and created a couple of databases. Someone told me that I should use perl to interact with mysql to build a reporting system. I have never used perl but I try running this code and always get this error:

C:\Documents and Settings\Administrator\Desktop\child>perl -w code.pl
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains:
C:/program files/perl/site/lib C:/program files/perl/lib .) at (eval 4) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge, mysqlPP.
at code.pl line 3

I downloaded activeperl and that is running hello world without a problem. I assume I need to install DBD:mysql so I downloaded DBD-mysql-4.006 but I get errors with the makefile.pl.

Any help would be appreciated.
 
Active Perl comes with the Perl Package Manager (PPM) for installing modules easily. You should not have to manually build your own Perl modules in most cases.

The ppm.pl should be in <Perl Install Directory>\bin.

Code:
cmd > path/to/perl/bin/ppm.pl
ppm > install DBI
ppm > install DBD-mysql
 
I found a file named ppm-shell that seems to be what you are talking about. Because ppm is the windows version with lots of packages but no cmd prompt to type into. Anyways here is the output of the shell after entering the above.


C:\Program Files\perl\bin>perl -w ppm-shell
ppm 4.01
Copyright (C) 2007 ActiveState Software Inc. All rights reserved.
ppm> install DBI
No missing packages to install
ppm> install DBD-mysql
ppm install failed: Can't find any package that provides DBD-mysql
ppm>
 
What version of ActivePerl are you running? I installed mine a while back so I don't know if they have changed the PPM stuff.

Under mine I launched the ppm.bat shell script and I was given the PPM command line, but my commands could execute.

In your PPM command line, can you type in this?

Code:
> search DBD

Does it return anything?
 
there's no reason to use perl specifically. if you are familiar with any other language it might be better to use that one. i find per a bit esoteric. i prefer php myself. it's more c-like.
 
there's no reason to use perl specifically. if you are familiar with any other language it might be better to use that one. i find per a bit esoteric. i prefer php myself. it's more c-like.

Heresy! :p

But it is true, just because someone tells you to use Perl doesn't mean you have to. I used to be big into Perl (still use it for text heavy scripting and for portability, since it's installed everywhere I deal with), but ever since learning the much cleaner Python, I have switched over to using that as my predominant language for, well, everything.
 
Hi guys,
First thanks for all the responses. Secondly, I've been wanting to get practice with perl because I know its really popular. Finally, I can run that command and this is the output:
Copyright (C) 2007 ActiveState Software Inc. All rights reserved.
ppm> search DBD
1: DBD-ADO v2.96
2: DBD-AnyData v0.09
3: DBD-CSV v0.22
4: DBD-File v0.35
5: DBD-LDAP v0.09
6: DBD-Log v0.22
7: DBD-MVS_FTPSQL v0.38.14
8: DBD-Mimer v1.00
9: DBD-Mock v1.36
10: DBD-Multiplex v2.06
11: DBD-ODBC v1.15
12: DBD-Ovrimos v0.12
13: DBD-PgPP v0.05
14: DBD-SQLrelay v0.1
15: DBD-Sprite v0.59
16: DBD-Template v0.01
17: DBD-XBase v0.241
18: DBD-mysql-SimpleMySQL v0.5
19: DBD-mysql-informationschema v0
20: DBD-mysqlPP v0.04
21: DBIx-AnyDBD v2.01

As you can see There are some entries taht are interesting but none are the package I downloaded.
 
So I've gotten alot farther, I have found the mysql.h and mysqlclient.lib that it was looking for when i customized my install of mysql. Now its giving me a c compiler issue except im pretty sure i dont have one.

*** Warning: whitespace characters in the current directory path (C:/Program Fil
es/perl/lib/DBD-mysql) may cause problems

*** You're using Microsoft Visual C++ compiler or similar but
the LIB and INCLUDE environment variables are not both set.

You need to run the VCVARS32.BAT batch file that was supplied
with the compiler before you can use it.

A copy of vcvars32.bat can typically be found in the following
directories under your Visual Studio install directory:
Visual C++ 6.0: vc98\bin
Visual Studio .NET: vc7\bin

Find it, run it, then retry this.

If you think this error is not correct then just set the LIB and
INCLUDE environment variables to some value to disable the check.

What do I do now? Any suggestions?
 
....just install wamp for php and mysql and be done with it :p

i had to do some perl for a class in college and i just hate it...
 
Hi matrixfan083,

I too am getting the same error when I try to install DBD::MySQL. Have you got it solved? If so can you please share with me how you solved the problem?

PVL
 
I haven't tried it, but I heard its a problem with the new active perl. Try an older version and work your way up to that magic release. BTW keep us updated if you find anything.
 
Thank you very much. I will try with an older version. I have been trying with 5.10.x. Will let you know if I happen to find a solution.
 
I tried with 5.8.x version of Perl and got the same message as well. But using the XAMPP package in the site http://www.apachefriends.org/en/xampp-windows.html#641 I could very easily install all the packages. Actually it installs almost all the packages of Perl along with MySQL, Perl, Apache along with many more softwares. Just thought would share this info in case you have not tried this option earlier.
 
Back
Top