How do I get a list of installed CPAN modules?

后端 未结 29 2180
盖世英雄少女心
盖世英雄少女心 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: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!)

提交回复
热议问题