【发布时间】:2015-06-19 17:31:13
【问题描述】:
- perl 版本是 5.8.8
- mysql版本为5.5.42
- DBI 版本是 1.633,DBD::mysql 版本是 4.022
我在共享托管服务器上。 我有一个运行良好的 perl 模块文件。我可以从 perl 脚本文件中毫无问题地使用它的 subs。如果我将此添加到 pm 文件中,
use DBI;
my $username = "username";
my $password = "password";
my $dsn = "DBD:mysql:database"; # i changed DBD to DBI as well but no good
仍然一切正常。 但是只要我将以下行添加到 perl 模块文件,perl 脚本文件就会开始抱怨“Compilation failed in require”
my $dbh = DBI->connect($dsn, $username, $password ) or die $DBI::errstr;
我尝试用谷歌搜索它,但没有结果。有什么想法吗?
【问题讨论】:
-
请修正您的数据源名称:它应该以
DBI:开头。您的DBD::mysql驱动程序模块的安装似乎有问题。尝试在use DBI下方添加use DBD::mysql,看看会出现什么错误
标签: perl perl-module dbi