如何判断 Perl 模块是核心还是标准安装的一部分? [英] How can I tell if a Perl module is core or part of the standard install?

查看:30
本文介绍了如何判断 Perl 模块是核心还是标准安装的一部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查 Perl 模块是否是核心的一部分 - 即它是标准安装的一部分?

How can I check if a Perl module is part of the core - i.e. it is part of the standard installation?

我正在寻找:

  • 命令行命令:
  • 用于检查代码内的 Perl 子例程/函数

也许问题应该是:我如何知道机器上安装了特定 Perl 时最初提供了哪些模块?(实际上,现在被问为 我如何知道机器上的特定 Perl 安装最初提供了哪些模块?.)

Perhaps the question should be: How can I tell what modules were originally provided with the specific Perl installation on a machine? (Actually, it is now asked as How can I tell what modules were originally provided with the specific Perl installation on a machine?.)

鉴于现在似乎没有完整的 Perl 标准安装,至少这个新问题的答案会告诉我第一次安装时我在安装中最初有什么.

Given that there now appears to not to be an overall Perl standard installation, at least the answer to this new question will tell me what I originally had in the installation when it was first installed.

有了这些知识,并且如果我保留原始安装程序映像/包或知道如何再次在线获取确切的内容,那么我就可以为多台机器进行可重复的 Perl 安装,并且知道将出现哪些模块以及将出现哪些模块不是.

With that knowledge and if I keep the original installer image/package OR know how to get the exact thing again online, then I have a repeatable Perl installation for several machines with the knowledge of what modules will be present and what modules will not.

进一步澄清:我正在查看安装最初的带来了什么,作为该安装的一部分提供了哪些模块,以及内置了哪些模块.不是从那时起安装了什么.

To clarify further: I am looking at what came with the installation originally, what modules were provided as part of that installation, and what was built-in. NOT what has been installed since then.

而且我希望能够在有安装的机器上执行此操作.因此,为此,我将依靠安装以某种形式记录它的原始内容.

And I want to be able to do this on the machine that has the installation. So for this I would be relying upon the installation to have a record in some form as to what it has originally.

我问了衍生问题:如何我能知道机器上特定的 Perl 安装最初提供了哪些模块吗?(我如何知道机器上特定的 Perl 安装最初提供了哪些模块?)

I asked spin-off question: How can I tell what modules were originally provided with the specific Perl installation on a machine? (How can I tell what modules were originally provided with the specific Perl installation on a machine?)

推荐答案

corelist 命令来自Module::CoreList 模块将确定模块是否为核心.

The corelist command from the Module::CoreList module will determine if a module is Core or not.

> corelist Carp

Carp was first release with perl 5

> corelist XML::Twig

XML::Twig was not in CORE (or so I think)

这是在脚本中使用它的一种方法.Module::CoreList POD 太简洁了——你必须在源代码中寻找要调用的方法:

Here is one way to use it in a script. The Module::CoreList POD is too terse -- you have to go hunting through the source code to find what methods to call:

use strict;
use warnings;
use Module::CoreList;

my $mod = 'Carp';
#my $mod = 'XML::Twig';
my @ms = Module::CoreList->find_modules(qr/^$mod$/);
if (@ms) {
    print "$mod in core
";
}
else {
    print "$mod not in core
";
}

__END__

Carp in core

这篇关于如何判断 Perl 模块是核心还是标准安装的一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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