是什么 ? | : | Inventory management of installed Perl modules. |
开发语言 | : | Perl |
metacpan | : | https://metacpan.org/pod/ExtUtils::Installed |
操作系统 | 包管理器 | 安装命令 |
---|---|---|
All | cpan | cpan -i ExtUtils::Installed |
All | cpanm | cpanm ExtUtils::Installed |
CentOS | yum | sudo yum install -y perl-ExtUtils-Install |
dnf | sudo dnf install -y perl-ExtUtils-Install | |
openSUSE | zypper | sudo zypper install -y perl-ExtUtils-Install |
创建ExtUtils::Installed
实例。
示例:
use ExtUtils::Installed;
my $installed = ExtUtils::Installed -> new();
列出所有已安装模块的名字。
示例:
my @moduleNames = $installed -> modules();
foreach (@moduleNames) {
print "$_\n";
}
查看指定模块的版本。
示例1:
my $version = $installed -> version("ExtUtils::Installed");
示例2:
my @moduleNames = $installed -> modules();
foreach (@moduleNames) {
my $version = $installed -> version($_) || "???";
printf("%-22s -Version- %-22s\n", $_, $version);
}
查看指定模块的文件。
示例1:
my @files = $installed -> files("ExtUtils::Installed");
foreach (@files) {
print "$_\n";
}
示例2:
my @moduleNames = $installed -> modules();
foreach (@moduleNames) {
my @files = $installed -> files($_);
foreach (@files) {
print "$_\n";
}
}
查看指定模块的目录。
示例1:
my @dirs = $installed -> directories("ExtUtils::Installed");
foreach (@dirs) {
print "$_\n";
}
示例2:
my @moduleNames = $installed -> modules();
foreach (@moduleNames) {
my @dirs = $installed -> directories($_);
foreach (@dirs) {
print "$_\n";
}
}
查看指定模块的目录树。
示例1:
my @dirs = $installed -> directory_tree("ExtUtils::Installed");
foreach (@dirs) {
print "$_\n";
}
示例2:
my @moduleNames = $installed -> modules();
foreach (@moduleNames) {
my @dirs = $installed -> directory_tree($_);
foreach (@dirs) {
print "$_\n";
}
}
查看指定模块的文件是否有遗失。
示例:
my @missingFiles = $installed -> validate("ExtUtils::Installed");
my $missingFileCount = @missingFiles;
if ($missingFileCount == 0) {
print "OK\n";
} else {
print "KO\n";
}