> -----Ursprüngliche Nachricht-----
> Von: Jamal Nasir [mailto:mjamal_nasir@stripped]
> Gesendet: Dienstag, 27. Juli 2010 15:52
> i have installed perl in windows.
> When i execute the following code:
>
> #!/usr/bin/perl
>
> # PERL MODULE
>
> use DBD::Mysql;
>
> # HTTP HEADER
> print "Content-type: text/html \n\n";
>
> # CONFIG VARIABLES
> $host = "127.0.0.1";
> $database = "shah569";
>
> $user = "jmlnsr";
> $pw = "ntr562";
>
> # PERL MYSQL CONNECT
> $connect = Mysql->connect($host, $database, $user, $pw);
> print 'Hello';
>
> I get following error in apache error log.
>
>
> Can't locate object method "connect" via package "Mysql"
> (perhaps you forgot to
> load "Mysql"
As the documentation for DBD::mysql points out (right at the start), the way to use DBI
and, in particular, the MySQL driver is this:
use DBI;
$dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
$dbh = DBI->connect($dsn, $user, $password);
\Gisbert