How do I get a list of installed CPAN modules?

后端 未结 29 2083
盖世英雄少女心
盖世英雄少女心 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 07:57

    You can get list of perl modules installed in you system by using instmodsh command in your terminal.It will ask you three option in order to enhance the output they are:

       l            - List all installed modules
       m <module>   - Select a module
       q            - Quit the program
    
    0 讨论(0)
  • 2020-12-04 07:58

    the Perl cookbook contains several iterations of a script "pmdesc" that does what you want. Google-search for "Perl Cookbook pmdesc" and you'll find articles on other Q&A Sites, several code listings on the net, a discussion of the solution, and even some refinements.

    0 讨论(0)
  • 2020-12-04 07:59

    Here a script which would do the trick:

    use ExtUtils::Installed;
    
    my $inst = ExtUtils::Installed->new();
    my @modules = $inst->modules();
    foreach $module (@modules){
           print $module ." - ". $inst->version($module). "\n";
    }
    
    =head1 ABOUT
    
    This scripts lists installed cpan modules using the ExtUtils modules
    
    =head1 FORMAT
    
    Prints each module in the following format
    <name> - <version>
    
    =cut
    
    0 讨论(0)
  • 2020-12-04 07:59

    Here is yet another command-line tool to list all installed .pm files:

    Find installed Perl modules matching a regular expression

    • Portable (only uses core modules)
    • Cache option for faster look-up's
    • Configurable display options
    0 讨论(0)
  • 2020-12-04 07:59

    All those who can't install perldoc, or other modules, and want to know what modules are available (CPAN or otherwise), the following works for linux and Mingw32/64:

    grep -RhIP '^package [A-Z][\w:]+;' `perl -e 'print join " ",@INC'` | sed 's/package //' | sort | uniq
    

    Yes, it's messy. Yes, it probably reports more than you want. But if you pipe it into a file, you can easily check for, say, which dbm interfaces are present:

     grep -RhIP '^package [A-Z][\w:]+;' `perl -e 'print join " ",@INC'` | sed 's/package //' | sort | uniq > modules-installed
     cat modules-installed | grep -i dbm 
    
    AnyDBM_File;
    Memoize::AnyDBM_File;
    Memoize::NDBM_File;
    Memoize::SDBM_File;
    WWW::RobotRules::AnyDBM_File;
    

    Which is why I ended up on this page (disappointed)

    (I realise this doesn't answer the OP's question exactly, but I'm posting it for anybody who ended up here for the same reason I did. That's the problem with stack*** it's almost imposisble to find the question you're asking, even when it exists, yet stack*** is nearly always google's top hit!)

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

    Try man perllocal or perldoc perllocal.

    0 讨论(0)
提交回复
热议问题