在 Windows 上安装 Curl for Perl (WWW::Curl::Easy)

use*_*195 5 windows perl curl

我在 Windows 上运行 Strawberry Perl,需要使用 WWW::Curl::Easy。但是“抱歉,Windows 上没有可用的自动安装”。

CPAN 上有一个 README.Win32:

Installation on Windows need to be done manually, by editing Makefile.PL.

1. Specify your curl include directory on the line "my @include = qw()".
2. Specify the following parameters on the line below, where <DIR> is your curl directory like this:

my ($cflags,$ldflags,$lflags) = ('-I"<DIR>\\include"', '-L"<DIR>\\lib"','-lcurl -lcurldll');

<DIR> can be for example: "E:\\Perldev\\downloader\\curl-7.18.2-devel-mingw32" (without quotes);
3. Save Makefile.PL.
4. Execute "perl Makefile.PL";
5. Execute "nmake" ( you may need nmake from Mircosoft, which can be downloaded from http://support.microsoft.com/default.aspx?scid=kb;en-us;Q132084 );
6. Execute "nmake install".
Run Code Online (Sandbox Code Playgroud)

不幸的是,我不明白我需要怎么做。我想用 dmake 而不是 nmake 应该是可能的,对吧?不同的“包含目录”是什么意思?

目前采取的步骤:

  • 安装草莓 perl
  • 使用 ssl 下载并解压 libcurl(curl-7.40.0-devel-mingw32.zip)
  • 从 CPAN 下载并解压 WWW::Curl
  • 编辑 Makefile.pl

    -#my @includes = qw();
    +my @includes = qw(C:\Strawberry\curl-7.40.0-devel-mingw32\include);
    -#my ($cflags,$lflags, $ldflags) = ('','','');
    +my ($cflags,$ldflags,$lflags) = ('-I"C:\Strawberry\curl-7.40.0-devel-mingw32\include"', '-L"C:\Strawberry\curl-7.40. 0-devel-mingw32\lib"','-lcurl -lcurldll');
    ...
    -#replace open(H_IN, "-|", "gcc $curl_h");
    +open(H_IN, "|gcc $curl_h");

  • 编辑 curl.xs(工作正在进行中)

有人可以举例说明安装步骤吗?

任何帮助深表感谢 !谢谢你。

Pau*_*ove 1

回答您的问题:

dmake 是 GNU make 的一个端口,并不是 Microsoft nmake 的替代品,我会按照说明使用 nmake。

通过不同的包含目录,我假设您指的是$cflags您包含的变量-I<DIR>\\include以及@include您还包含相同路径的数组 - 按照README.Win32文件的指示。

阅读Makefile.PL,我可以看到无论如何@include实际上都是由$cflags变量填充的,因此我认为没有理由同时修改@include$cflags,尽管同时在​​两个地方指定路径也没有什么坏处。

最终@include搜索数组,如果找到包含curl头文件的目录/curl/curl.h,则用于构建perl模块。

给出的说明是所有应该需要的,请指定您当前的错误,说明没有提到编辑curl.xs您对此文件做什么工作?

顺便说一句,我不知道您的要求是什么,但LWP::Useragent我发现的模块更容易跨平台安装,并且提供了大部分(如果不是全部)功能以及更多功能WWW:Curl::Easy

如果您仍然遇到问题,请提供您在问题中收到的错误的详细信息。

古克运气。