error of importing DBI in Perl

橙三吉。 提交于 2019-12-31 05:30:05

问题


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

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

and the error is compilation failed in require.

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

Please help and thank you very much


回答1:


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

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

More information can be found in the example code of Perl Modules in the perlmod documentation.




回答2:


"Compilation failed in require" indicates compilation cannot continue beyond that point due to an earlier error. Solve the earlier error and this one will go away.



来源:https://stackoverflow.com/questions/5036430/error-of-importing-dbi-in-perl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!