--- tpage 2011-07-12 04:27:14.140625000 -0700 +++ tpage-new2 2011-07-12 04:42:08.796875000 -0700 @@ -39,6 +39,7 @@ # unshift any perl5lib directories onto front of INC unshift(@INC, @{ $config->perl5lib }); +my $binmode = $config->binmode; # get all template_* options from the config and fold keys to UPPER CASE my %ttopts = $config->varlist('^template_', 1); my $ttmodule = delete($ttopts{ module }); @@ -67,10 +68,13 @@ my $template = $ttmodule->new($ucttopts) || die $ttmodule->error(); +binmode STDOUT; # process each input file foreach my $file (@ARGV) { $file = \*STDIN if $file eq '-'; - $template->process($file) +#~ $template->process($file, undef, \*STDOUT, $binmode ? {binmode => $binmode} : {} ) +#~ $template->process($file, undef, \*STDOUT, {binmode => !!$binmode} ) + $template->process($file, undef, \*STDOUT, ) || die $template->error(); } @@ -83,6 +87,8 @@ ERROR => sub { die(@_, "\ntry `$NAME --help'\n") } }, 'help|h' => { ACTION => \&help }, + 'binmode=s', + 'template_encoding|encoding=s', 'template_absolute|absolute' => { DEFAULT => 1 }, 'template_relative|relative' => { DEFAULT => 1 }, 'template_module|module=s', @@ -167,6 +173,10 @@ --perl5lib=DIR Specify additional Perl library directories --template_module=MODULE Specify alternate Template module +File encoding options + --binmode=value Set binary mode of output files + --encoding=value Set encoding of input files + See 'perldoc tpage' for further information. END_OF_HELP