微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何找到Perl模块的安装位置?

如何通过名称获取已安装的Perl模块的路径,
例如时间:: HiRes?

我想这只是因为我必须在SGE Grid Engine系统的不同节点上运行我的perl脚本。有时,甚至作为其他用户名运行。

我可以使用CPAN.pm为自己安装软件包,但它不是那么容易为其他用户安装没有chmod 666文件夹。

解决方法

我创建了 whichpm一个跨平台CLI(Linux,OSX,Window),通过模块(包)名定位已安装的Perl模块,并且可选地报告有关它们的信息,包括检测偶然的重复。

例子

# Locate the Data::Dumper module.
$ whichpm Data::Dumper
/usr/lib/perl/5.18/Data/Dumper.pm

# Locate the Data::Dumper module,and also print
# version @R_498_4045@ion and core-module status.
$ whichpm -v Data::Dumper
Data::Dumper    2.145   core>=5.005 /usr/lib/perl/5.18/Data/Dumper.pm

# Locate the Data::Dumper module and open it in your system's default text
# editor.
$ whichpm -e Data::Dumper

# Look for accidental duplicates of the Foo::Bar module.
# normally,only 1 path should be returned.
$ whichpm -a Foo::Bar
/usr/lib/perl/5.18/Foo/Bar.pm
./Foo/Bar.pm

# Print the paths of all installed modules.
$ whichpm -a

安装

先决条件:安装了Perl v5.4.50或更高版本的Linux,OSX或Windows。

从npm注册表安装

安装Node.jsio.js时,按如下所示安装the package

[sudo] npm install whichpm -g

手动安装(OSX和Linux)

>下载the CLI。>使它可执行的chmod x whichpm。>将其移动或符号链接到$ PATH中的文件夹,例如/usr/local/bin(OSX)或/ usr / bin(Linux)。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐