【发布时间】:2014-02-18 08:42:14
【问题描述】:
我尝试从 CPAN 安装 DBD-SQLite-0.31 模块。我已经从CPAN 下载了DBD-SQLite-0.31。我尝试安装它,它给了我一个先决条件DBI 模块不存在的错误。
我从 CPAN 安装了 DBI 模块,然后安装了DBD-SQLite-0.31。
当我尝试运行 perl 语句
use DBI DBD::SQLite; 时,它给出了错误
"DBD::SQLite" is not exported by the DBI module
Can't continue after import errors at DBI.txt line 3
BEGIN failed--compilation aborted at DBI.txt line 3.
为什么会发生错误?
当我尝试调试它时,我发现要运行语句use DBI DBD::SQLite;,DBD::SQLite 需要在 DBI 目录中,但两者都在不同的目录中。我什至在 DBI 文件夹中复制了 DBD::SQLite,但问题仍然存在。 (这些都是我的胡思乱想)
【问题讨论】:
-
对于 DBI 和 DBD::SQLite,您需要 2 个单独的
use语句。你不能一次导入,那是不正确的语法。 -
@DA14,您根本不需要 DBD::SQLite 的
use语句。当您连接到 SQLite 数据库时,它会由 DBI 自动加载。
标签: perl