在Perl中导入DBI时出错 [英] error of importing DBI in Perl

查看:62
本文介绍了在Perl中导入DBI时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Perl编写代码,并尝试将其保存在扩展名 .pm 而不是 .pl

I am writing the code in Perl and try to save it in the extension .pm not .pl

,我使用 use DBI; 导入DBI以便执行查询。

and I use use DBI; to import the DBI in order that I can execute the query.

并且错误是编译失败,要求

但是,我确实在 script.pl 中使用过,没关系..它可以正常工作..

However, I did use in script.pl , it s okay.. it works..

请帮忙,谢谢

推荐答案

您可能只是错过了 1;。在.pm文件的末尾。

You probably simply miss the "1;" at the end of the .pm file.

Perl模块始终必须返回 true值。只需输入 1;即可完成。

Perl modules always have to return a "true" value. This is accomplished by simply putting "1;" at the end of the file.

更多信息可以在 Perl模块

这篇关于在Perl中导入DBI时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆