cpanm是安裝Perl模塊的最方便的方法。自動下載安裝依賴包。使用CPAN shell或下載源碼包安裝模塊,遇到大量依賴關系,非常頭痛。下面就是一例:
安裝MongoDB模塊
1. 安裝cpanm
cpanm其實是一個可執行文件而已。將它下載到bin目錄,然后添加執行權限就可以了。
2. 使用cpanm安裝模塊
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模塊
為了加快下載速度, 可以指定使用鏡像,并只從鏡像下載:
3. 刪除模塊
安裝App::pmuninstall模塊:
4.刪除模塊
MongoDB.so: undefined symbol: HeUTF8 問題解決方案參見:http://www.companysz.com/article/56285.htm
新聞熱點
疑難解答