Perl - MySQL connection problem in windows

Posted by dexter on Stack Overflow See other posts from Stack Overflow or by dexter
Published on 2010-03-24T12:40:40Z Indexed on 2010/03/24 12:43 UTC
Read the original article Hit count: 387

Filed under:
|
|

I have two folders php and perl they contain index.php and index.pl respectivly

in index.pl

my perl code looks like:

#!/usr/bin/perl
use Mysql;

print "Content-type: text/html\n\n"; 
print "<h2>PERL-mySQL Connect</h2>";
print "page info";
$host = "localhost";
$database = "cdcol";
$user = "root";
$password = "";
$db = Mysql->connect($host, $database, $user, $password);
$db->selectdb($database);

when i run above code (ie type: http://localhost:88/perl/ in browser)

following error comes

Error message: Can't locate Mysql.pm in @INC (@INC contains: C:/xampp/perl/site/lib/ C:/xampp/perl/lib C:/xampp/perl/site/lib C:/xampp/apache) at C:/xampp/htdocs/perl/index.pl line 2. BEGIN failed--compilation aborted at C:/xampp/htdocs/perl/index.pl line 2.

while this works: in browser http://localhost:88/php/

where index.php has:

<?php
$con = mysql_connect("localhost","root","");
            if($con)
            {
                if(mysql_select_db("cdcol", $con))
                {
                    $sql="SELECT Id From products";
                    if(mysql_query($sql))
                    {
                        $result = mysql_query($sql);
                        if ($result)............

© Stack Overflow or respective owner

Related posts about perl

Related posts about mysql