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

查看:126
本文介绍了如何确定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安装最初提供了哪些模块? (实际上,现在它被要求为

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 模块将确定模块是否为Core.

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\n";
}
else {
    print "$mod not in core\n";
}

__END__

Carp in core

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

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