zoukankan      html  css  js  c++  java
  • linux 查看是否安装perl模块

    这里介绍两种linux中查看perl模块是否安装的方法,一种是对于单体的模块,一种是对于群体的。

    单体验证:

    [root@root ~]# perl -MShell -e "print"module installed ""
    module installed

    这里使用-M后边紧跟着Shell这个perl模块,如果输出module installed结果。那么此模块是存在在系统中的。

    [root@root ~]# perl -MMail::Sender -e "print"module installed ""
    Can't locate Mail/Sender.pm in @INC (@INC contains: /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .).
    BEGIN failed--compilation aborted.

    如果出现类似于这种Can't locate。。。的提示,那么证明你系统中没有安装此模块。

    群体验证:

    这里所谓的群体验证只有一种方式,那么就是使用一个脚本来输出系统中所有已安装的perl脚本:

    #!/usr/bin/perl
    use strict;
    use ExtUtils::Installed;

    my $inst = ExtUtils::Installed->new();

    my @modules = $inst->modules();

    foreach  (@modules) {
            my  $ver = $inst->version($_) || "???";
            printf("%-22s -Version- %-22s ", $_, $ver);
    }
    exit;

    运行得到的结果为:

    DBD::Oracle           -Version- 1.16                  
    DBI                       -Version- 1.611                 
    ExtUtils::Install        -Version- 1.54                  
    Perl                       -Version- 5.8.8  

  • 相关阅读:
    ASP.NET Core 2.2 基础知识(七) 选项模式
    ASP.NET Core 2.2 基础知识(六) 配置(内含MySql+EF)
    ASP.NET Core 2.2 基础知识(五) 环境
    ASP.NET Core 2.2 基础知识(四) URL重写中间件
    shell 环境变量
    shell 数值运算
    shell IF分支判断语句
    WINDOWS 端口查看
    mybatis-ResultMappingResolver类信息
    shell 基本概述
  • 原文地址:https://www.cnblogs.com/nkwy2012/p/6016247.html
Copyright © 2011-2022 走看看