TT-2.15をActivePerlにインストールする

Template-Toolkit-2.15をActivePerl,VC++ 2005 Express + Platform SDK環境にインストールしようとしたところ失敗した.

で,エラーメッセージ見るとsnprintfでビルドにこけていて,これVCだと_snprintfなんだよなーと思いつつ,Stash.xsに

#define snprintf _snprintf

してみたら案の定ビルドできた.以下パッチ.

--- xs/Stash.xs~	Sun May 14 17:40:42 2006
+++ xs/Stash.xs	Sat Jun 03 23:45:52 2006
@@ -35,6 +35,10 @@
 extern "C" {
 #endif
 
+#ifdef _MSC_VER
+#define snprintf _snprintf
+#endif
+
 #define PERL_NO_GET_CONTEXT
 #include "EXTERN.h"
 #include "perl.h"

続いてnmake testしたところ,t/fileline.tでテストにこけた.また確認.

C:\Temp\Template-Toolkit-2.15>perl -Iblib/lib -Iblib/arch t/fileline.t
1..11
ok 1 - running test_expect()
ok 2 - template processor is engaged
ok 3 - input read and split into 4 tests
ok 4 - template text 1 processed OK: [% place = 'World' -%]\nHello [% ...
ok 5 - template text 1 matched expected
ok 6 - template text 2 processed OK: [% INCLUDE warning -%]\nfile: [% ...
MATCH FAILED
 input: [[% INCLUDE warning -%]\nfile: [% file.chunk(-16).last %]\nline: [% line %]\nwarn: [% warn %]\n]
expect: [Hello\nWorld\nfile: test/lib/warning\nline: 2\nwarn: Argument "" isn't numeric in addition (+)]
output: [Hello\nWorld\nfile: test\lib\warning\nline: 2\nwarn: Argument "" isn't numeric in addition (+)]
FAILED 7:  - template text 2 did not match expected
not ok 7 - template text 2 did not match expected
ok 8 - template text 3 processed OK: [% INCLUDE warning -%]\nfile: [% ...
ok 9 - template text 3 matched expected
ok 10 - template text 4 processed OK: [% TRY; \n     INCLUDE chomp; \n  ...
ok 11 - template text 4 matched expected

test/lib/warningとtest\lib\warningがマッチしねぇぞってわけか.これはWindows環境ならでは,しかもCPANモジュールを入れようとすると結構ぶち当たるエラーだったりするのよね.というわけで,華麗にスルーしてforce installでいいと思います.