【问题标题】:installing CPAN module on windows在 Windows 上安装 CPAN 模块
【发布时间】:2011-05-17 07:06:57
【问题描述】:

我正在尝试在 Windows 7 上安装 CPAN 模块。我没有 Active Perl,因此无法使用 PPM 包。

所有网站上给出的步骤都包括这三个步骤:make、make test 和 make install。我知道 make 是 unix 命令,不会在 Windows 上运行。

我应该在 Windows 上运行什么命令来完成安装?

我从 CPAN 的站点下载了 dmake,正如其中一个站点所提到的,但是当我运行它时,它会出现以下错误 -

D:\Parse-RecDescent-1.965001.tar\Parse-RecDescent-1.965001>D:\dmake\dmake\dmake dmake:错误:-- `D:\indigoampp\perl-5.12.1\libConfig.pm' 未找到,无法制作

请告诉我如何完成这些步骤。谢谢!

PS:同样,PPM 不是一个选项。


谢谢大家。

在 indigoampp\perl-5.12.1\lib 位置有一个名为 Config_heavy.pl 的文件。它有一行:make='nmake'。我在使用 dmake 命令时将其更改为 make='dmake'。

在此之后,我不需要在每个模块的 Makefile 中更改 DIRFILESEP。它现在正在生成 \\ 如上述链接中所述。

所以我现在可以运行 dmake、dmake test 和 dmake install。然而它什么也没做。它没有在各个位置复制 pm 文件/文件。为什么会这样??

无论如何,我手动复制了 pm 文件/文件,希望一切正常。但是,我以前也可以这样做。为什么我运行 makefile.pl 和 dmake 命令??

另外,我的目标是安装 Apache2::Request 模块。我发现它依赖于多个模块。我下载了这些模块并为它们运行了上面的命令 - 没有错误。最后,当我为 Apache2::Request 模块运行这些步骤时,在 dmake 命令中出现以下错误:

D:\libapreq2-2.12.tar\libapreq2-2.12>dmake
dmake:  makefile:  line 25:  Warning: -- Duplicate target [Release]
dmake:  makefile:  line 25:  Warning: -- Duplicate target [Release]
dmake:  makefile:  line 25:  Warning: -- Duplicate target [!=]
dmake:  makefile:  line 25:  Error: -- Expecting macro or rule defn, found neith
er

我在 libapreq2-2.12.tar\libapreq2-2.12 文件夹下的 Makefile 中没有发现任何可疑内容。 Makefile 的部分内容(错误行周围)是:

LIBAPREQ=libapreq2
APREQ2_TEST=apreq2_test
CGITEST=test_cgi
MOD=mod_apreq2

!IF "$(CFG)" != "Release" && "$(CFG)" != "Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE 
!MESSAGE NMAKE CFG="Release"
!MESSAGE 
!MESSAGE Possible choices for configuration are:
!MESSAGE 
!MESSAGE "Release" (based on "Win32 (x86) Console Application")
!MESSAGE "Debug" (based on "Win32 (x86) Console Application")
!MESSAGE 
!ERROR An invalid configuration is specified.
!ENDIF 

!IF "$(APACHE)" == ""
!MESSAGE No Apache directory was specified.
!MESSAGE Please run Configure.bat to specify a valid Apache directory.
!ERROR
!ENDIF

任何人都可以帮助解决这个和上述问题(为什么它没有自动复制 pm 文件)?感谢您的宝贵时间!

【问题讨论】:

  • 你的问题类似于cpanforum.com/posts/9514,也许这应该解决它:cpanforum.com/posts/9716
  • 查看 Strawberry Perl (strawberryperl.com),它是一个适用于 Windows 的优秀 Perl 发行版,附带 dmake 和在 Windows 下构建 XS 模块所需的其他工具。
  • make 是一个常见于 UNIX 系统的程序,但它可用于 Windows(Strawberry Perl 将捆绑一个副本)

标签: perl makefile cpan mod-perl mod-perl2


【解决方案1】:

看起来您正在使用 Indigo Perl。根据他们的网站,他们有自己的包管理器,称为 IPM - 你试过吗?

但对于 Windows Perl 工作,我真的建议查看 Strawberry Perl

【讨论】:

  • 我没有使用 IPM。我现在看看。谢谢。
  • 我还要看看 Strawberry Perl。我实际上需要一个带有 mod_perl2 的 perl(因为我在将 mod_perl2 与 perl 集成时遇到了问题),这就是为什么我安装了 Apache 和 Perl 附带的 All In One Indigo 包(带有 mod_perl2)。
【解决方案2】:

有时要安装 Perl 模块,您只需将 .pm 文件复制到 perl/site 或 perl/lib 中的相应目录即可。安装 Perl 模块的标准过程总是涉及运行“make”,但在许多情况下,“make”所做的只是将 .pm 文件复制到 perl/site 或 perl/lib。但是当 Perl 模块需要对 Windows 库进行低级访问时,您需要的不仅仅是“make”,还需要一个完整的 C 工具链。

如果 ActiveState Perl 反对您的宗教信仰,请考虑下载并安装 Cygwin 环境。为 Cygwin 安装选择 Perl 和 C 开发工具(称为 binutils)。

但我告诉你,ActiveState Perl 很难击败。它是 Windows 平台上最完整的 Perl 解决方案。而且它是免费的!

【讨论】:

  • 自 2006 年以来情况发生了变化。值得冒险看看 win32.perl.org 看看一些良性竞争。
猜你喜欢
  • 2017-07-19
  • 2011-11-02
  • 2018-03-28
  • 2011-03-29
  • 2018-06-19
  • 2014-12-06
  • 2013-11-04
  • 2013-09-24
  • 1970-01-01
相关资源
最近更新 更多