Subject: | [patch] add binmode handling to ttree |
Added a binmode option to ttree to allow setting of utf mode etc to
output files of ttree.
Subject: | tt-binmode.patch |
diff -ur Template-Toolkit-2.19-orig/bin/ttree Template-Toolkit-2.19/bin/ttree
--- Template-Toolkit-2.19-orig/bin/ttree 2007-04-27 18:56:05.000000000 +0100
+++ Template-Toolkit-2.19/bin/ttree 2007-11-15 20:00:38.000000000 +0000
@@ -73,6 +73,7 @@
my $absolute = $config->absolute;
my $relative = $config->relative;
my $suffix = $config->suffix;
+my $binmode = $config->binmode;
my $depends = $config->depend;
my $depsfile = $config->depend_file;
my $srcdir = $config->src
@@ -385,7 +386,8 @@
# process file
unless ($dryrun) {
- $template->process($file, $replace, $destfile)
+ $template->process($file, $replace, $destfile,
+ $binmode ? {binmode => $binmode} : undef)
|| print(" ! ", $template->error(), "\n");
if ($preserve) {
@@ -524,6 +526,7 @@
'ignore=s@',
'copy=s@',
'accept=s@',
+ 'binmode=s',
'depend=s%',
'depend_debug|depdbg',
'depend_file|depfile=s' => { EXPAND => EXPAND_ALL },
@@ -702,6 +705,9 @@
File suffix rewriting (may appear multiple times)
--suffix old=new Change any '.old' suffix to '.new'
+File encoding options
+ --binmode=value Set binary mode of output files
+
Additional options to set Template Toolkit configuration items:
--define var=value Define template variable
--interpolate Interpolate '\$var' references in text
@@ -958,6 +964,9 @@
You can provide any number of different suffix mappings by repeating
this option.
+The C<binmode> option is used to set the encoding of the output file.
+For example use C<--binmode=:utf8> to set the output format to unicode.
+
=head2 Template Dependencies
The C<depend> and C<depend_file> options allow you to specify