Chinaunix

标题: Windows 下安装Perl cpan模块 [打印本页]

作者: ptg0808    时间: 2007-11-07 13:14
标题: Windows 下安装Perl cpan模块

Windows XP 下安装Perl cpan模块  





  


1、从
www.cpan.org
搜索你所需要的模块,下载下来,一般是gz,或者tgz格式
2、用winRAR之类解压缩软件接压缩
3、进入COMMAN模式,进入到刚才解压缩的文件夹下,含有“Makefile.PL”文件的目录下:
依次运行:
        perl Makefile.PL
        nmake
        nmake test
        nmake install
安装就完成了.
我的系统是Windows XP, 安装的是ActivePerl-5.8.8.817-MSWin32-x86-257965.msi
具体的平台安装方法可参考cpan官方说明:
http://www.cpan.org/modules/INSTALL.html


A frequently asked question: "Where can I find make for Windows?". The answer is: "Download and use NMake".
Downloading NMake
Since Microsoft Windows hasn't in it's default install a make program needed to build the Perl modules, you have to download NMake 1.5 from the
Microsoft Knowledge Base, article 132084
page.
Installing NMake
Run the downloaded executable to extract the files. Copy both the NMAKE.EXE and the NMAKE.ERR file to your Perl bin directory, normally C:\Perl\bin. Make sure that you copy the NMAKE.ERR file as well.
Example of an NMake session
Normally building Perl modules and installing them consist of the following steps:
  • perl Makefile.pl
  • make
  • make test
  • make install
    Just replace make with nmake, and in many cases this will result in a working module (or modules) installed in the proper location(s).
    Below follows an example of building the Net-Google Perl module, and installing it. See
    Net-Google with ActiveState Perl
    for more information.
    perl Makefile.PL
    Checking if your kit is complete...
    Looks good
    Writing Makefile for Net::Google
    nmake
    Microsoft (R) Program Maintenance Utility   Version 1.50
    Copyright (c) Microsoft Corp 1988-94. All rights reserved.
    cp lib/Net/Google/Search.pm blib\lib\Net\Google\Search.pm
    cp lib/Net/Google.pm blib\lib\Net\Google.pm
    cp lib/Net/Google/tool.pm blib\lib\Net\Google\tool.pm
    cp lib/Net/Google/Spelling.pm blib\lib\Net\Google\Spelling.pm
    cp lib/Net/Google/Cache.pm blib\lib\Net\Google\Cache.pm
    cp lib/Net/Google/Services/GoogleSearch.wsdl blib\lib\Net\Google
    \Services\GoogleSearch.wsdl
    cp lib/Net/Google/Service.pm blib\lib\Net\Google\Service.pm
    cp lib/Net/Google/Response.pm blib\lib\Net\Google\Response.pm
    nmake test
    Microsoft (R) Program Maintenance Utility   Version 1.50
    Copyright (c) Microsoft Corp 1988-94. All rights reserved.
        C:\Perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "tes
    t_harness(0, 'blib\lib', 'blib\arch')" t\000-key.t t\001-search.
    t t\002-spelling.t t\003-cache.t t\000-key.........#
    # The Google API web service requires that you provide create a
    Google Account and obtain a license key
    # This key is then passed with each request you make to the Goog
    le servers.
    # If you do not already have a Google Account, you can sign up f
    or one here:
    # http://www.google.com/apis/
    #
    # Please enter your Google API key:
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    t\000-key.........ok
    t\001-search......ok
    t\002-spelling....ok
    t\003-cache.......ok
    All tests successful.
    Files=4, Tests=18, 103 wallclock secs ( 0.00 cusr +  0.00 csys =
    0.00 CPU)
    nmake install
    Microsoft (R) Program Maintenance Utility   Version 1.50
    Copyright (c) Microsoft Corp 1988-94. All rights reserved.
    Installing C:\Perl\site\lib\Net\Google.pm
    Installing C:\Perl\site\lib\Net\Google\Cache.pm
    Installing C:\Perl\site\lib\Net\Google\Response.pm
    Installing C:\Perl\site\lib\Net\Google\Search.pm
    Installing C:\Perl\site\lib\Net\Google\Service.pm
    Installing C:\Perl\site\lib\Net\Google\Spelling.pm
    Installing C:\Perl\site\lib\Net\Google\tool.pm
    Installing C:\Perl\site\lib\Net\Google\Services\GoogleSearch.wsd
    l
    Appending installation info to C:\Perl\lib/perllocal.pod

    本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/15138/showart_416471.html




    欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2