Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I want to write perl script to load data to mysql database and wrote a
simple test code:

use mysql;
$host = "localhost";
$connect =  connect($host, $db , $user, $pwd);

When the script was run, perl returned error message:

Can't locate mysql.pm in @INC (@INC contains: C:/xampp/perl/lib C:/
xampp/perl/site/lib .) at c:\tsql.pl line 1.
BEGIN failed--compilation aborted at c:\tsql.pl line 1.

mysql module is under c:\xampp/perl/site/lib/DBD and I tried to
specify the sub directory where the module is located.

use mysql 'DBD';

But, it did not solve the problem.

The system is Windows 7 installed the xampp

I appreciate any comments and suggestion.

Re: @INC

Quoted text here. Click to load it

Okay, first thing. The module you're trying to use here isn't "mysql",
it's DBD::mysql. Use() requires the full package name, not just the
last component of it.

Second thing, you don't use DBD::* modules like that. You use the DBI
module, and specify which driver to load in your data source name.

Quoted text here. Click to load it

Random guesswork rarely does. Try reading the docs for the module you
are trying to use instead. I don't know where xampp installs them, but
there might be a start menu item. You might be able to type "perldoc
DBD::mysql" at a command prompt. As a last resort, they can be found
on the web at:



Sherm Pendley
Cocoa Developer

Site Timeline