cpanm是安裝Perl模塊的最方便的方法。自動(dòng)下載安裝依賴包。使用CPAN shell或下載源碼包安裝模塊,遇到大量依賴關(guān)系,非常頭痛。下面就是一例:
# cpanm -h
-v,--verbose Turns on chatty output
-q,--quiet Turns off the most output
--interactive 開啟交互配置(required for Task:: modules)
-f,--force 強(qiáng)制安裝
-n,--notest Do not run unit tests
--test-only 只測(cè)試不安裝
-S,--sudo sudo to run install commands
--installdeps 只安裝依賴模塊
--showdeps 只顯示依賴信息
--reinstall 重新安裝
--mirror 指定鏡像url (e.g. http://cpan.cpantesters.org/)
--mirror-only 只從鏡像下載
--prompt Prompt when configure/build/test fails
-l,--local-lib Specify the install base to install modules
-L,--local-lib-contained Specify the install base to install all non-core modules
--self-contained Install all non-core modules, even if they're already installed.
--auto-cleanup Number of days that cpanm's work directories expire in. Defaults to 7
Examples:
cpanm Test::More # install Test::More
cpanm MIYAGAWA/Plack-0.99_05.tar.gz # full distribution path
cpanm http://example.org/LDS/CGI.pm-3.20.tar.gz # install from URL
cpanm ~/dists/MyCompany-Enterprise-1.00.tar.gz # install from a local file
cpanm --interactive Task::Kensho # Configure interactively
cpanm . # install from local directory
cpanm --installdeps . # install all the deps for the current directory
cpanm -L extlib Plack # install Plack and all non-core deps into extlib
cpanm --mirror http://cpan.cpantesters.org/ DBI # use the fast-syncing mirror
MongoDB.so: undefined symbol: HeUTF8 問題解決方案參見:https://www.jb51.net/article/56285.htm