Subject: [Templates] ttree problems - the sequel

From: Michael Stevens <[email-masked]>
Date: Tue, 28 Nov 2000 21:15:46 +0000

Hi.
  I finally had time to debug my problems with pre_process and ttree
in more detail.

It turned out that ttree thinks PRE_PROCESS and POST_PROCESS are
multiple value fields, so it returns the values supplied for them as arrays,
eg

  pre_process = foo:bar

is sent to Template as PRE_PROCESS => [ 'foo:bar' ]. The delimiter splitting
routines in Template::Service only split up if values are scalars rather
than array references, so it wasn't getting split, and therefore it tried
to pre_process the file 'foo:bar'.

ttree learnt that those two fields were arrays sometime between beta5 and
rc2, I'm not sure why.

One fix, as far as I can tell, is to apply this patch:

--cut here for patch--
diff -urN Template-Toolkit-2.00-rc2.orig/bin/ttree Template-Toolkit-2.00-rc2/bin/ttree
--- Template-Toolkit-2.00-rc2.orig/bin/ttree	Tue Nov 28 20:56:28 2000
+++ Template-Toolkit-2.00-rc2/bin/ttree	Tue Nov 28 20:57:18 2000
@@ -324,8 +324,8 @@
 	'template_pre_chomp|pre_chomp|prechomp',
 	'template_post_chomp|post_chomp|postchomp',
 	'template_trim|trim',
-        'template_pre_process|pre_process|preprocess=s@',
-        'template_post_process|post_process|postprocess=s@',
+        'template_pre_process|pre_process|preprocess=s',
+        'template_post_process|post_process|postprocess=s',
         'template_process|process=s',
         'template_default|default=s',
         'template_error|error=s',
--cut here for patch--

Which reverts this change. However, if this was originally done for a good
reason, it's not the end of the story. The modified version passes all tests
still, but I can't see that they actually exercise ttree.

Michael

_______________________________________________
templates mailing list
[email-masked]
http://www.template-toolkit.org/mailman/listinfo/templates