如何从命令行检查我的系统上是否安装了 Perl 模块? [英] How can I check if a Perl module is installed on my system from the command line?

查看:35
本文介绍了如何从命令行检查我的系统上是否安装了 Perl 模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图检查我的系统中是否安装了 XML::Simple.

I tried to check if XML::Simple is installed in my system or not.

perl -e 'while (<@INC>) { while (<$_/*.pm>) { print "$_
"; } }'

上面的单行代码用于列出我系统中安装的所有模块.但是,它没有列出 XML 模块.

The above one-liner was used for listing all modules installed in my system. However, it is not listing XML modules.

但是,以下执行得很好.

However, the following executes fine.

perl -e "use XML::Simple "

可能是什么问题?

推荐答案

您可以通过以下方式检查模块的安装路径:

You can check for a module's installation path by:

perldoc -l XML::Simple

单行的问题在于,它不是递归遍历目录/子目录.因此,您只能获得实用的模块名称作为输出.

The problem with your one-liner is that, it is not recursively traversing directories/sub-directories. Hence, you get only pragmatic module names as output.

这篇关于如何从命令行检查我的系统上是否安装了 Perl 模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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