How do I get a list of installed CPAN modules?

后端 未结 29 2085
盖世英雄少女心
盖世英雄少女心 2020-12-04 07:41

Aside from trying

perldoc 

individually for any CPAN module that takes my fancy or going through the file system and loo

相关标签:
29条回答
  • 2020-12-04 08:03

    Here's a Perl one-liner that will print out a list of installed modules:

    perl -MExtUtils::Installed -MData::Dumper -e  'my ($inst) = ExtUtils::Installed->new(); print Dumper($inst->modules());'
    

    Just make sure you have Data::Dumper installed.

    0 讨论(0)
  • 2020-12-04 08:03

    Try "perldoc -l":

    $ perldoc -l Log::Dispatch /usr/local/share/perl/5.26.1/Log/Dispatch.pm

    0 讨论(0)
  • 2020-12-04 08:05

    The answer can be found in the Perl FAQ list.

    You should skim the excellent documentation that comes with Perl

    perldoc perltoc
    
    0 讨论(0)
  • 2020-12-04 08:08

    Here's a really hacky way to do it in *nix, you'll get some stuff you don't really care about (ie: warnings::register etc), but it should give you a list of every .pm file that's accessible via perl.

    
    for my $path (@INC) {
        my @list = `ls -R $path/**/*.pm`;
        for (@list) {
            s/$path\///g;
            s/\//::/g;
            s/\.pm$//g;
            print;
        }
    }
    
    
    0 讨论(0)
  • 2020-12-04 08:08

    For Linux the easiest way to get is,

    dpkg -l | grep "perl"
    
    0 讨论(0)
提交回复
热议问题