11.19 如何安装Perl模块 https://scz.617.cn/unix/201111010926.txt A: scz 先说一下Windows的情况,假设已经安装ActivePerl 5.14.1或更高版本。 > perl -v This is perl 5, version 14, subversion 1 (v5.14.1) built for MSWin32-x86-multi-thread > ppm 这个版本的ppm是GUI界面的,不必再记那么多命令了,全部是鼠标操作。缺省的 Repository只有一个: ActiveState Package Repository http://ppm4.activestate.com/MSWin32-x86/5.14/1401/package.xml 可以去"Edit->Preferences->Repositories"里增加Suggested: log4perl http://log4perl.sourceforge.net/ppm sisyphusion http://www.sisyphusion.tk/ppm/package.xml wxperl http://www.wxperl.co.uk/repository/package.xml 之后就能找到绝大多数模块,右键选择安装即可。假设需要安装IO::Socket::INET6, 在ppm中应该找IO-Socket-INET6,就是把::换成-。 D: scz 下面是5.8.0.804版的操作过程: > perl -v This is perl, v5.8.0 built for MSWin32-x86-multi-thread > ppm PPM - Programmer's Package Manager version 3.0.1. ppm> help Type 'help command' for more detailed help on a command. Commands: describe - describes packages in detail exit - exits the program help - prints this screen, or help on 'command' install - installs packages profiles - manage PPM profiles properties - describes installed packages in detail q - exits the program query - queries installed packages quickstart - a crash course in using PPM quit - exits the program remove - uninstalls packages repository - adds, removes, or sets repositories s - searches for packages in a repository - no help available search - searches for packages in a repository settings - view or set PPM options targets - views or sets target installer backends tree - shows package dependency tree uninstall - uninstalls packages upgrade - shows availables upgrades for installed packages version - displays the PPM version (3.0.1) Extra Help Topics: (not commands) ppm_migration - guide for those familiar with PPM prompt - how to interpret the PPM prompt unicode - notes about unicode author names ppm> search Getopt-Long Searching in Active Repositories 1. Getopt-Long [2.37] Module to handle parsing command line options 2. Getopt-Long [2.37] Getopt-Long 3. Getopt-Long-Descriptive [0.070] Getopt::Long with usage text 4. Getopt-Long-Descriptive [0.070] Getopt-Long-Descriptive 5. Getopt-Long-GUI [0.1] 6. Getopt-Long-GUI [0.1] Getopt-Long-GUI ppm> install Getopt-Long Successfully installed Getopt-Long version 2.37 in ActivePerl 5.8.0.804. ppm> query Getopt-Long Querying target 1 (ActivePerl 5.8.0.804) 1. Getopt-Long [2.37] Module to handle parsing command line options ppm> exit A: scz 在Debian上安装IO::Socket::INET6 $ aptitude install make $ perl -MCPAN -e shell cpan> h cpan> o conf cpan> o conf init 这一步不要选自动,一路手工配下去,重点是选一个可访问的CPAN下载(镜像)站,比 如: http://mirrors.163.com/cpan/ cpan> install YAML cpan> install IO::Socket::SSL cpan> install IO::Socket::INET6 cpan> q 如果前期配置正常的话,可以直接执行如下命令进行安装: $ perl -MCPAN -e "install IO::Socket::INET6" D: scz 在Linux下perl -MCPAN -e "install ..."时,有些网络模块带了make test,但我朝 寡妇王多牛B啊,铁定失败,接下来模块安装失败,但从上下文里看make已经成功了。 可以直接去~/.cpan/build/下找编译目录,自己执行make install,绕过make test 即可。当然,你得确认这个绕过是有道理的,这是有上下文的。