我在 64 位 Windows 7 上使用 Strawberry Perl。cpanm 对于 cpan 中的许多包都失败了:
$ cpanm Getopt::Long::Descriptive
Fetching http://www.cpan.org/authors/id/R/RJ/RJBS/Getopt-Long-Descriptive-0.097.tar.gz ... OK
Configuring Getopt-Long-Descriptive-0.097 ... N/A
! The distribution doesn't have a proper Makefile.PL/Build.PL See C:\Users\me\.cpanm\work\1399608810.1056\build.log for details.
然而,cpan -i Getopt::Long::Descriptive
成功了。知道为什么吗?
编辑(build.log 输出)
cpanm (App::cpanminus) 1.7001 on perl 5.018002 built for MSWin32-x64-multi-thread
Work directory is C:\Users\me/.cpanm/work/1399608810.1056
You have make C:\strawberry\c\bin\dmake.exe
You have LWP 6.05
You have C:\dev\tools\UnxUtils\usr\local\wbin\tar.exe, C:\dev\tools\UnxUtils\usr\local\wbin\gzip.exe and C:\dev\tools\UnxUtils\usr\local\wbin\bzip2.exe
You have C:\dev\tools\UnxUtils\usr\local\wbin\unzip.exe
Searching Getopt::Long::Descriptive on cpanmetadb ...
--> Working on Getopt::Long::Descriptive
Fetching http://www.cpan.org/authors/id/R/RJ/RJBS/Getopt-Long-Descriptive-0.097.tar.gz
-> OK
Unpacking Getopt-Long-Descriptive-0.097.tar.gz
Entering Getopt-Long-Descriptive-0.097
META.yml/json not found. Creating skeleton for it.
Configuring Getopt-Long-Descriptive-0.097
-> N/A
-> FAIL The distribution doesn't have a proper Makefile.PL/Build.PL See C:\Users\me\.cpanm\work\1399608810.1056\build.log for details.
编辑(解包问题)
有趣的是,看起来文件已被解压,但从未出现在磁盘上!
C:\Users\me>cpanm -v --look Getopt::Long::Descriptive
cpanm (App::cpanminus) 1.5018 on perl 5.016002 built for MSWin32-x64-multi-thread
Work directory is C:\Users\me/.cpanm/work/1399909160.7264
You have make C:\strawberry\c\bin\dmake.exe
You have LWP 6.04
You have C:\UnxUtils\usr\local\wbin\tar.exe, C:\UnxUtils\usr\local\wbin\gzip.exe and C:\UnxUtils\usr\local\wbin\bzip2.exe
You have C:\UnxUtils\usr\local\wbin\unzip.exe
Searching Getopt::Long::Descriptive on cpanmetadb ...
--> Working on Getopt::Long::Descriptive
Fetching http://www.cpan.org/authors/id/R/RJ/RJBS/Getopt-Long-Descriptive-0.097.tar.gz ... OK
Unpacking Getopt-Long-Descriptive-0.097.tar.gz
Getopt-Long-Descriptive-0.097
README
Changes
LICENSE
dist.ini
META.yml
MANIFEST
META.json
Makefile.PL
t
descriptive.t
shortcircuit.t
release
pod-syntax.t
000-report-versions-tiny.t
Long
Descriptive.pm
changes_has_content.t
Descriptive
Opts.pm
Usage.pm
Entering Getopt-Long-Descriptive-0.097
Entering C:/Users/me/.cpanm/work/1399909160.7264/Getopt-Long-Descriptive-0.097 with C:\Windows\system32\cmd.exe
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\me\.cpanm\work\1399909160.7264\Getopt-Long-Descriptive-0.097>dir
Volume in drive C is OS
Volume Serial Number is 008E-DBB0
Directory of C:\Users\me\.cpanm\work\1399909160.7264\Getopt-Long-Descriptive-0.097
05/12/2014 11:39 AM <DIR> .
05/12/2014 11:39 AM <DIR> ..
0 File(s) 0 bytes
2 Dir(s) 48,360,112,128 bytes free
编辑(找到文件,上一级)
C:\Users\me\.cpanm\work\1399909160.7264\Getopt-Long-Descriptive-0.097>cd ..
C:\Users\me\.cpanm\work\1399909160.7264>ls
000-report-versions-tiny.t Makefile.PL
Changes Opts.pm
Descriptive README
Descriptive.pm Usage.pm
Getopt-Long-Descriptive-0.097 changes_has_content.t
Getopt-Long-Descriptive-0.097.tar.gz descriptive.t
LICENSE dist.ini
Long pod-syntax.t
MANIFEST release
META.json shortcircuit.t
META.yml t
答案1
事实证明,在这种情况下,UnxUtils tar 是错误的。我不确定存档Getopt::Long::Descriptive
是如何创建的,但是 UnxUtils tar 在解压时会将内容压平。
另一方面,GnuWin32 tar 可以很好地处理档案。