如何从其分发目录中使用Perl模块? [英] How do I use Perl modules from their distribution directory?

查看:95
本文介绍了如何从其分发目录中使用Perl模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我从> http://guest.engelschall.com/~sb下载了Date::Calc /download/.

Assume I downloaded Date::Calc from http://guest.engelschall.com/~sb/download/.

现在,我有一个脚本xxx.pl,该脚本与我从上面的链接下载的解压缩后的内容"位于同一目录中. 解压缩后,它将创建一个包含大量内容的"Date-Calc-5.6"文件夹.

Now, I have a script, xxx.pl, which resides in the same directory as the untar-ed "thing" that I downloaded from the link above When untar-ed, it creates a "Date-Calc-5.6" folder with tons of stuff.

如何在xxx.pl中包含Date::Calc? (我不断收到无法在@INC中找到Date/Calc.pm"错误)

How do I include Date::Calc in xxx.pl? (I keep getting "Can't locate Date/Calc.pm in @INC" errors)

推荐答案

您首先需要安装模块.

@INC语句中,指定包含Perl模块的目录.或使用以下语句:use lib "path"能够通过其他use语句加载模块.

In your @INC statement, specify the directory containing your Perl modules. Or use the statement: use lib "path" to be able to load modules via additional use statements.

这篇关于如何从其分发目录中使用Perl模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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