Xampp, perl, mysql

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

Xampp, perl, mysql

Postby rj12a » 04. December 2009 21:19

Ok, so im trying to get perl working with xampp and Mysql heres the code i have, just doing a simple listing of tables.

Code: Select all
#!/usr/bin/perl

use Mysql;
#use strict;
print "Content-type: text/html \n\n";
#prevent Perl from creating undeclared variables
#not used
#my($host, $database, $tablename, $user, $pw, $connect, $db, $table);
#my(@tables);

# MYSQL CONFIG VARIABLES
$host = "localhost";
$database = "reg_perl";
$tablename = "tblcontacts";
$user = "username";
$pw = "password";

# PERL MYSQL CONNECT()
$connect = Mysql->connect($host, $database, $user, $pw);

# SELECT DB
$connect->selectdb($database);

# LISTTABLES()
@tables = $db->listtables;

# PRINT EACH TABLE NAME
@tables = $connect->listtables;
foreach $table (@tables) {
   print "$table<br />";
}


despite that i get this error when running it
Code: Select all
Can't locate Mysql.pm in @INC (@INC contains: /Applications/XAMPP/xamppfiles/lib/perl5/site_perl/5.10.0//darwin-2level /Applications/XAMPP/xamppfiles/lib/perl5/site_perl/5.10.0/ /Applications/XAMPP/xamppfiles/lib/perl5/5.10.0/darwin-2level /Applications/XAMPP/xamppfiles/lib/perl5/5.10.0 /Applications/XAMPP/xamppfiles/lib/perl5/site_perl/5.10.0/darwin-2level /Applications/XAMPP/xamppfiles/lib/perl5/site_perl/5.10.0 . /Applications/XAMPP/xamppfiles) at /Applications/XAMPP/xamppfiles/htdocs/perl/perl_reg_sql/registration.pl line 5. BEGIN failed--compilation aborted at /Applications/XAMPP/xamppfiles/htdocs/perl/perl_reg_sql/registration.pl line 5. ,


this line here though is close, its just in /DBD, is there any fix for this? I dont know where to even start

Code: Select all
/Applications/XAMPP/xamppfiles/lib/perl5/site_perl/5.10.0//darwin-2level


Any help would be appreciated thanks
rj12a
 
Posts: 8
Joined: 16. October 2009 21:06
Location: Wausau WI

Re: Xampp, perl, mysql

Postby jmdirc » 06. December 2009 07:19

if your looking for Perl in xampp - isn't this line mis-directing
Code: Select all
#!/usr/bin/perl


shouldn't it be
Code: Select all
#!/Applications/XAMPP/xamppfiles/var/perl/


and should you place your .pl files in htdocs - the call in the terminal will be: /Applications/XAMPP/xamppfiles/htdocs/

works fine here
An artist/designer/ and now programer exploring the creative sides.
User avatar
jmdirc
 
Posts: 154
Joined: 10. February 2008 22:44

Re: Xampp, perl, mysql

Postby rj12a » 06. December 2009 07:54

they are in htdocs, and i have already tried it with both shebang lines, neither works, i get the same error. Regular .pl files work just fine, its when it try to use the mysql there is a problem
rj12a
 
Posts: 8
Joined: 16. October 2009 21:06
Location: Wausau WI

Re: Xampp, perl, mysql

Postby Wiedmann » 06. December 2009 13:36

Code: Select all
use Mysql;

Can't locate Mysql.pm in @INC

You have a Mysql module somewhere?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany


Return to XAMPP for Mac OS X

Who is online

Users browsing this forum: No registered users and 1 guest