是否可以在Perl脚本中手动包括CPAN库? [英] Is it possible to manually include a CPAN library in a Perl script?

查看:46
本文介绍了是否可以在Perl脚本中手动包括CPAN库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我所处的情况是我编写了一个使用CPAN库XML :: Simple的perl脚本,并在能够安装必要的CPAN库的环境中进行了测试。

The situation I am in is that I have written a perl script which uses the CPAN library XML::Simple and tested in an environment which has the ability to install the necessary CPAN library.

但是必须在其中运行脚本的环境没有安装CPAN库的权限。我想知道是否有一些手动方法将Simple.pm文件包含在脚本中,并将其包含在脚本目录中?我尝试使用'use'和'require'都无济于事。

However the environment which the script must be run in does not have the permissions to install CPAN libraries. I was wondering if there is some manual way to include the Simple.pm file with my script and include it in the directory with the script? I have tried using 'use' and 'require' to no avail.

任何帮助都将不胜感激。

Any help is greatly appreciated.

edit:我能够通过手动下载Simple.pm文件并使用要求 Simple.pm的行来解决该问题;在我的代码中。我想当初尝试此方法时一定一定下载了不正确的文件。谢谢。

推荐答案

我能够通过手动下载Simple.pm文件并使用该行来解决此问题。要求 Simple.pm;在我的代码中。我想当初尝试此方法时,一定是以某种方式下载了不正确的文件。

I was able to solve the problem by manually downloading the Simple.pm file and using the line require "Simple.pm"; in my code. I think I must have downloaded the incorrect file somehow when I tried this orginally.

这篇关于是否可以在Perl脚本中手动包括CPAN库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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