Perl

安裝 MIME::Tools 失敗並在 t/Smtpsend.t 中出現錯誤

  • April 16, 2013

系統:debian 7 x64 RC 1 Perl 版本:v5.14.2

嘗試安裝 MIME::Tools 時,我無法正確編譯。

cpan[4]> install MIME::Tools
Going to read '/root/.cpan/Metadata'
Database was generated on Sat, 13 Apr 2013 01:41:02 GMT
Running install for module 'MIME::Tools'
Running make for D/DS/DSKOLL/MIME-tools-5.504.tar.gz
Checksum for /root/.cpan/sources/authors/id/D/DS/DSKOLL/MIME-tools-5.504.tar.gz ok
Scanning cache /root/.cpan/build for sizes
........................................................................----DONE
DEL(1/14): /root/.cpan/build/libwww-perl-6.05-ZDaNp5
DEL(2/14): /root/.cpan/build/File-Scan-ClamAV-1.91-Ti5677
DEL(3/14): /root/.cpan/build/Crypt-OpenSSL-Random-0.04-5B9ULy
DEL(4/14): /root/.cpan/build/Crypt-OpenSSL-RSA-0.28-04I5K5
DEL(5/14): /root/.cpan/build/Mail-DKIM-0.40-fzAICY
DEL(6/14): /root/.cpan/build/Net-CIDR-Lite-0.21-2WIaXR
DEL(7/14): /root/.cpan/build/Sys-Hostname-Long-1.4-DgtI9U
DEL(8/14): /root/.cpan/build/Mail-SPF-Query-1.999.1-RlMA1a
DEL(9/14): /root/.cpan/build/Mail-SPF-Query-1.999.1-gfsVza
DEL(10/14): /root/.cpan/build/Net-DNS-Resolver-Programmable-v0.003-Wuv2JV
DEL(11/14): /root/.cpan/build/Mail-SPF-v2.8.0-yUk_ZP
DEL(12/14): /root/.cpan/build/MLDBM-2.05-UYpHDK
DEL(13/14): /root/.cpan/build/Mail-SRS-0.31-F9Cxsm
DEL(14/14): /root/.cpan/build/Net-IP-Match-Regexp-1.01-I3a1Pe

 CPAN.pm: Going to build D/DS/DSKOLL/MIME-tools-5.504.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for MIME::Tools
Writing MYMETA.yml and MYMETA.json
cp lib/MIME/Body.pm blib/lib/MIME/Body.pm
cp lib/MIME/Decoder/Gzip64.pm blib/lib/MIME/Decoder/Gzip64.pm
cp lib/MIME/Field/ContDisp.pm blib/lib/MIME/Field/ContDisp.pm
cp lib/MIME/Parser/Results.pm blib/lib/MIME/Parser/Results.pm
cp lib/MIME/Field/ContType.pm blib/lib/MIME/Field/ContType.pm
cp lib/MIME/Decoder/NBit.pm blib/lib/MIME/Decoder/NBit.pm
cp lib/MIME/Entity.pm blib/lib/MIME/Entity.pm
cp lib/MIME/Head.pm blib/lib/MIME/Head.pm
cp lib/MIME/Parser/Filer.pm blib/lib/MIME/Parser/Filer.pm
cp lib/MIME/Words.pm blib/lib/MIME/Words.pm
cp lib/MIME/Field/ParamVal.pm blib/lib/MIME/Field/ParamVal.pm
cp lib/MIME/Decoder/BinHex.pm blib/lib/MIME/Decoder/BinHex.pm
cp lib/MIME/Field/ConTraEnc.pm blib/lib/MIME/Field/ConTraEnc.pm
cp lib/MIME/Tools.pm blib/lib/MIME/Tools.pm
cp lib/MIME/Decoder/Binary.pm blib/lib/MIME/Decoder/Binary.pm
cp lib/MIME/Decoder.pm blib/lib/MIME/Decoder.pm
cp lib/MIME/Decoder/UU.pm blib/lib/MIME/Decoder/UU.pm
cp lib/MIME/Decoder/QuotedPrint.pm blib/lib/MIME/Decoder/QuotedPrint.pm
cp lib/MIME/Decoder/Base64.pm blib/lib/MIME/Decoder/Base64.pm
cp lib/MIME/WordDecoder.pm blib/lib/MIME/WordDecoder.pm
cp lib/MIME/Parser.pm blib/lib/MIME/Parser.pm
cp lib/MIME/Parser/Reader.pm blib/lib/MIME/Parser/Reader.pm
Manifying blib/man3/MIME::Decoder::Gzip64.3pm
Manifying blib/man3/MIME::Body.3pm
Manifying blib/man3/MIME::Field::ContDisp.3pm
Manifying blib/man3/MIME::Parser::Results.3pm
Manifying blib/man3/MIME::Field::ContType.3pm
Manifying blib/man3/MIME::Decoder::NBit.3pm
Manifying blib/man3/MIME::Entity.3pm
Manifying blib/man3/MIME::Parser::Filer.3pm
Manifying blib/man3/MIME::Head.3pm
Manifying blib/man3/MIME::Words.3pm
Manifying blib/man3/MIME::Field::ParamVal.3pm
Manifying blib/man3/MIME::Decoder::BinHex.3pm
Manifying blib/man3/MIME::Field::ConTraEnc.3pm
Manifying blib/man3/MIME::Tools.3pm
Manifying blib/man3/MIME::Decoder::Binary.3pm
Manifying blib/man3/MIME::Decoder.3pm
Manifying blib/man3/MIME::Decoder::UU.3pm
Manifying blib/man3/MIME::Decoder::Base64.3pm
Manifying blib/man3/MIME::Decoder::QuotedPrint.3pm
Manifying blib/man3/MIME::WordDecoder.3pm
Manifying blib/man3/MIME::Parser::Reader.3pm
Manifying blib/man3/MIME::Parser.3pm
 DSKOLL/MIME-tools-5.504.tar.gz
 /usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/*.t
t/02-kwalitee.t ................... skipped: Test::Kwalitee not installed; skipping
t/02-pod-coverage.t ............... skipped: Test::Pod::Coverage disabled. TEST_POD_COVERAGE=1 if you want it.
t/02-pod.t ........................ skipped: Test::Pod 1.00 required for testing POD
t/99-prepare.t .................... ok
t/attachment-filename-encoding.t .. ok
t/Body.t .......................... ok
t/BodyPrint.t ..................... ok
t/Decoder.t ....................... # Using gzip: 1
t/Decoder.t ....................... ok
t/EmptyPart.t ..................... ok
t/Entity.t ........................ ok
t/Filer.t ......................... ok
t/Gauntlet.t ...................... ok
t/Head.t .......................... ok
t/Misc.t .......................... ok
t/ParamVal.t ...................... ok
t/Parser.t ........................ ok
t/ParserEncoded.t ................. ok
t/ParserPreamble.t ................ ok
t/Ref.t ........................... ok
t/Smtpsend.t ...................... accept failed: Connection timed out at t/Smtpsend.t line 61.
# Looks like your test exited with 110 before it could output anything.
t/Smtpsend.t ...................... Dubious, test returned 110 (wstat 28160, 0x6e00)
Failed 9/9 subtests
t/ticket-11901.t .................. ok
t/ticket-22684.t .................. ok
t/ticket-37139.t .................. ok
t/ticket-41632.t .................. ok
t/ticket-43439.t .................. ok
t/ticket-52924.t .................. ok
t/ticket-5462.t ................... ok
t/ticket-60931.t .................. ok
t/ticket-65681.t .................. ok
t/ticket-66025.t .................. ok
t/ticket-71041.t .................. ok
t/ticket-71677.t .................. ok
t/ticket-80433.t .................. ok
t/WordDecoder.t ................... ok
t/WordEncoder.t ................... ok
t/Words.t ......................... ok

Test Summary Report
-------------------
t/Smtpsend.t                    (Wstat: 28160 Tests: 0 Failed: 0)
 Non-zero exit status: 110
 Parse errors: Bad plan.  You planned 9 tests but ran 0.
Files=36, Tests=386, 26 wallclock secs ( 0.25 usr  0.37 sys +  2.79 cusr  1.00 csys =  4.41 CPU)
Result: FAIL
Failed 1/36 test programs. 0/386 subtests failed.
make: *** [test_dynamic] Error 255
 DSKOLL/MIME-tools-5.504.tar.gz
 /usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
 reports DSKOLL/MIME-tools-5.504.tar.gz
Running make install
 make test had returned bad status, won't install without force
Failed during this command:
DSKOLL/MIME-tools-5.504.tar.gz               : make_test NO

所以這失敗了:

t/Smtpsend.t ...................... accept failed: Connection timed out at t/Smtpsend.t line 61.
# Looks like your test exited with 110 before it could output anything.
t/Smtpsend.t ...................... Dubious, test returned 110 (wstat 28160, 0x6e00)

我確實找到關於這個問題的一些東西,但它沒有用。它表示要從此更改程式碼

# In the parent
my $s = $sock->accept();
if (!$s) {
   kill(9, $pid);
   die("accept failed: $!");
}

對此

sleep 1;

# In the parent
my $s = $sock->accept();
if (!$s) {
   kill(9, $pid);
   die("accept failed: $!");

}

但我的程式碼是這樣的

# In the parent
my $s = $sock->accept();
if (!$s) {
       sleep(1);
       $s = $sock->accept();
       if (!$s) {
               kill(9, $pid);
               die("accept failed: $!");
       }
}

雖然我確實sleep 1;在評論之前放了一個(雖然我懷疑在這個較新的版本中,睡眠被添加到了條件中)它仍然沒有正確編譯。

有什麼想法嗎 ?

謝謝!

你讓它正確編譯,它只是沒有通過一項測試!更多人抱怨測試失敗,請參見此處。你可能不應該太擔心它。這意味著您可以強制安裝該軟體包,它應該可以正常工作。

但總的來說,如果您使用系統 perl,請盡可能通過包管理器安裝盡可能多的包 - 這也可以解決您的問題。在 Debian 上,它很簡單

apt-get install libmime-tools-perl

你就完成了!

我有同樣的問題,經過調查,我認為我已經確定了根本原因。

我分離了伺服器和客戶端程式碼以消除任何時間問題,並發現客戶端或發送方在嘗試使用 Mail::Util 中的 mailaddress() 函式辨識發件人時延遲了大約 30 秒。

所以我發現的解決方法如下,在 Smtpsend.t 的開頭,即在 use 語句之後添加以下行,

$ENV{MAILDOMAIN} = ’example.com';

測試仍然需要 13 秒才能執行,但它成功完成。你當然可以在你的 shell 中設置這個環境變數,但我對可以與包一起分發的解決方案感興趣。

讓我知道這是否適用於您的環境。我在 OSX 上執行。

我將向 Mime::Tools 傢伙提出一個問題。

引用自:https://serverfault.com/questions/498988