如何检查Perl模块是否是核心的一部分 - 即它是标准安装的一部分?
我在找:
命令行命令: 一个Perl子程序/函数来检查代码也许问题应该是:如何知道最初在机器上安装特定 Perl的模块? (实际上,现在被问及如何知道最初在机器上安装特定Perl的模块? )
鉴于现在似乎不是一个整体的Perl标准安装,至少这个新问题的答案将会告诉我在安装时最初安装的是什么。
有了这些知识,如果我保留原始的安装程序映像/软件包或知道如何再次在线获得确切的事情,那么我有一个可重复的Perl安装几台机器,知道什么模块将出现什么模块不会。
进一步澄清:我正在看最初的安装,什么模块作为安装的一部分提供,什么是内置的。 不是从那以后安装的。
而且我想要能够在安装的机器上这样做。 所以,为了这个原因,我将依靠安装以某种形式记录它原来的内容。
我问了分拆问题: 我如何知道最初在机器上安装特定Perl的模块? (如何知道最初在机器上安装特定Perl的模块?)
How can I check if a Perl module is part of the core - i.e. it is part of the standard installation?
I'm looking for:
a command-line command: a Perl subroutine/function to check within codePerhaps 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?.)
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.
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.
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?)
最满意答案
Module :: CoreList模块的corelist命令将确定模块是否为Core。
> 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太简单了 - 你必须通过源代码去寻找哪些方法来调用:
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 coreThe 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)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模块是核心还是标准安装的一部分?(How can I tell if a Perl module is core or part of the standard install?)如何检查Perl模块是否是核心的一部分 - 即它是标准安装的一部分?
我在找:
命令行命令: 一个Perl子程序/函数来检查代码也许问题应该是:如何知道最初在机器上安装特定 Perl的模块? (实际上,现在被问及如何知道最初在机器上安装特定Perl的模块? )
鉴于现在似乎不是一个整体的Perl标准安装,至少这个新问题的答案将会告诉我在安装时最初安装的是什么。
有了这些知识,如果我保留原始的安装程序映像/软件包或知道如何再次在线获得确切的事情,那么我有一个可重复的Perl安装几台机器,知道什么模块将出现什么模块不会。
进一步澄清:我正在看最初的安装,什么模块作为安装的一部分提供,什么是内置的。 不是从那以后安装的。
而且我想要能够在安装的机器上这样做。 所以,为了这个原因,我将依靠安装以某种形式记录它原来的内容。
我问了分拆问题: 我如何知道最初在机器上安装特定Perl的模块? (如何知道最初在机器上安装特定Perl的模块?)
How can I check if a Perl module is part of the core - i.e. it is part of the standard installation?
I'm looking for:
a command-line command: a Perl subroutine/function to check within codePerhaps 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?.)
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.
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.
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?)
最满意答案
Module :: CoreList模块的corelist命令将确定模块是否为Core。
> 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太简单了 - 你必须通过源代码去寻找哪些方法来调用:
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 coreThe 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)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
发布评论