Catalyst::Plugin::FillInForm の install に失敗したときの対応
仕事の関係で、1ヶ月ほど前から、5年ぶりぐらいに Perl の世界に戻ってきてます。5年も離れていると、すっかり浦島太郎状態で、DBIC って何?DBI じゃないの?というレベルなのですが、とにかく、Catalyst やら Moose やらの「モダンPerl」に日々格闘中です。
で、このエントリの本題ですが、Catalyst::Plugin::FillInForm のバージョン0.11 をインストールしようとしたら、テストに失敗してしまったけど、何とか対応できた、というお話です。久々のブログ更新でいきなり技術的な濃いエントリですが、気にしない、気にしない。
CPAN からインストールしようとすると、以下のようにテストに失敗してしまいました。
$ sudo cpan Catalyst::Plugin::FillInForm Running install for module 'Catalyst::Plugin::FillInForm' Running make for F/FL/FLORA/Catalyst-Plugin-FillInForm-0.11.tar.gz Has already been unwrapped into directory /Users/Yoshihide/.cpan/build/Catalyst-Plugin-FillInForm-0.11-RwmONZ Has already been made 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/01use.t .......... ok t/02pod.t .......... skipped: set TEST_POD to enable this test t/03podcoverage.t .. skipped: set TEST_POD to enable this test t/04fillform1.t .... [error] No default action defined t/04fillform1.t .... 1/3 # Failed test 'OK status code' # at t/04fillform1.t line 22. # got: '500' # expected: '200' Parsing of undecoded UTF-8 will give garbage when decoding entities at t/04fillform1.t line 23. # Failed test 'Re-Parsed HTML' # at t/04fillform1.t line 24. # got: undef # expected: 'form1:aaa|one|bbb|two|ccc|three|ddd|four|form2:aaa|one|bbb|two|ccc|three|ddd|four|' # Looks like you failed 2 tests of 3. t/04fillform1.t .... Dubious, test returned 2 (wstat 512, 0x200) Failed 2/3 subtests t/04fillform2.t .... [error] No default action defined t/04fillform2.t .... 1/3 # Failed test 'OK status code' # at t/04fillform2.t line 22. # got: '500' # expected: '200' Parsing of undecoded UTF-8 will give garbage when decoding entities at t/04fillform2.t line 23. # Failed test 'Re-Parsed HTML' # at t/04fillform2.t line 24. # got: undef # expected: 'form1:aaa||bbb|two|ccc|three|ddd|four|form2:aaa||bbb|two|ccc|three|ddd|four|' # Looks like you failed 2 tests of 3. t/04fillform2.t .... Dubious, test returned 2 (wstat 512, 0x200) Failed 2/3 subtests t/04fillform3.t .... [error] No default action defined t/04fillform3.t .... 1/3 # Failed test 'OK status code' # at t/04fillform3.t line 22. # got: '500' # expected: '200' Parsing of undecoded UTF-8 will give garbage when decoding entities at t/04fillform3.t line 23. # Failed test 'Re-Parsed HTML' # at t/04fillform3.t line 24. # got: undef # expected: 'form1:aaa||bbb||ccc||ddd||form2:aaa|one|bbb|two|ccc|three|ddd|four|' # Looks like you failed 2 tests of 3. t/04fillform3.t .... Dubious, test returned 2 (wstat 512, 0x200) Failed 2/3 subtests t/04fillform4.t .... [error] No default action defined t/04fillform4.t .... 1/3 # Failed test 'OK status code' # at t/04fillform4.t line 22. # got: '500' # expected: '200' Parsing of undecoded UTF-8 will give garbage when decoding entities at t/04fillform4.t line 23. # Failed test 'Re-Parsed HTML' # at t/04fillform4.t line 24. # got: undef # expected: 'form1:aaa|one|bbb|two|ccc|three|ddd||form2:aaa|one|bbb|two|ccc|three|ddd||' # Looks like you failed 2 tests of 3. t/04fillform4.t .... Dubious, test returned 2 (wstat 512, 0x200) Failed 2/3 subtests Test Summary Report ------------------- t/04fillform1.t (Wstat: 512 Tests: 3 Failed: 2) Failed tests: 2-3 Non-zero exit status: 2 t/04fillform2.t (Wstat: 512 Tests: 3 Failed: 2) Failed tests: 2-3 Non-zero exit status: 2 t/04fillform3.t (Wstat: 512 Tests: 3 Failed: 2) Failed tests: 2-3 Non-zero exit status: 2 t/04fillform4.t (Wstat: 512 Tests: 3 Failed: 2) Failed tests: 2-3 Non-zero exit status: 2 Files=7, Tests=13, 4 wallclock secs ( 0.04 usr 0.02 sys + 3.37 cusr 0.29 csys = 3.72 CPU) Result: FAIL Failed 4/7 test programs. 8/13 subtests failed. make: *** [test_dynamic] Error 2 FLORA/Catalyst-Plugin-FillInForm-0.11.tar.gz /usr/bin/make test -- NOT OK //hint// to see the cpan-testers results for installing this module, try: reports FLORA/Catalyst-Plugin-FillInForm-0.11.tar.gz Running make install make test had returned bad status, won't install without force Failed during this command: FLORA/Catalyst-Plugin-FillInForm-0.11.tar.gz : make_test NO
「Parsing of undecoded UTF-8 will give garbage when decoding entities」というエラーメッセージからいろいろググってみて、HTML::Parser あたりの問題かと思ったのですが、原因がいまいちはっきりしません。もう一度テスト結果をよく見てみると、どうやら HTTPステータスが 200 を返さずに 500 を返しているようです。tar ファイルをローカルに落としてきて、t/04fillform1.t を見てみると、テスト用のCatalystアプリ(t/lib/TestApp1.pm)を動かしているらしい。つまり、Catalyst のサーバーが Internal Server Error を吐いているのがテストが失敗している原因のようです。というわけで、$response->content の中身をHTMLファイルに書き出してみました。すると、Catalyst の見慣れたエラー画面が。
No default action defined
t/lib/TestApp1.pm のソースを見てみると、確かに default アクションが定義されていない。なので、以下のコードを追加してみました。
my ( $self, $c ) = @_;
$c->res->body($html);
}
そしてテストを実行してみると・・・
t/04fillform1.t .. ok All tests successful. Files=1, Tests=3, 1 wallclock secs ( 0.03 usr 0.00 sys + 0.81 cusr 0.06 csys = 0.90 CPU) Result: PASS
ひゃっほい!通った!他の、t/lib/TestApp*.pm も同じ改修をしたら、テストはすべて通り、無事インストールすることができました。
というわけで、最初は依存モジュールをいろいろ疑ったのですが、どうやらテストコードに問題があったようです。なので、force installしちゃってもよさそうですね。
ちなみに、私の環境では、Catalyst 5.80007 を使いました。たぶん、 Catalyst::Plugin::FillInForm の Makefile.PL を見ると
とあったので、5.8系に対応したテストコードになっていなかったんじゃないかと思うんですが、本当のところはどうなんでしょうか?教えて、えらい人!
もし、同じ症状でお困りの方のお役に立てれば幸いです。
About this entry
- Published:
- 2009/07/03
- Category:
- web development
- Response:
- 0 comment | 0 trackback
- Bookmark:
2 users
0 user
0 user


No Trackbacks
trackback uri:コメントやトラックバックは承認待ちになる場合がありますので、すぐに反映されない場合はしばらくお待ちください。