PERL CGI gives me error connecting MySQL
Posted
by dexter
on Stack Overflow
See other posts from Stack Overflow
or by dexter
Published on 2010-03-25T07:19:07Z
Indexed on
2010/03/25
7:23 UTC
Read the original article
Hit count: 600
this is the code by Sinan Ünür
for more information see this Example
use strict; use warnings;
use CGI::Simple;
use DBI;
my $cgi = CGI::Simple->new;
my $dsn = sprintf(
'DBI:mysql:database=%s;host=%s',
'cdcol', 'localhost'
);
my $dbh = DBI->connect($dsn, root => '',
{ AutoCommit => 0, RaiseError => 0 }
);
my $status = $dbh ? 'Connected' : 'Failed to connect';
print $cgi->header, <<HTML;
<!DOCTYPE HTML>
<html>
<head><title>Test</title></head>
<body>
<h1>Perl CGI Script</h1>
<p>$status</p>
</body>
</html>
HTML
this code gives me error:
The server encountered an internal error and was unable to complete your request.
Error message:
Can't locate CGI/Simple.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 4. BEGIN failed--compilation aborted at C:/xampp/htdocs/perl/index.pl line 4. ,
Error 500
localhost
3/25/2010 11:19:19 AM
Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1
what does this means ?
how to resolve this
© Stack Overflow or respective owner