Subject: | TRIM option creates output with no newline on the final line. |
The TRIM option causes output files to be written without a newline on
the final line, which upsets software that cares about such things.
We are generating C/C++ code from templates and g++ complains - I
understand a C++ source with incomplete final line can cause undefined
behaviour according to the standards.
To reproduce, please see the attached program, which runs itself
through Template::process, and check the output.
Subject: | test.pl |
#! /usr/bin/perl -w
use strict;
use Template;
# Create a template processor.
#
my $config = {'INCLUDE_PATH' => ".",
'OUTPUT_PATH' => ".",
'TRIM' => 1,
};
my $tt = Template->new($config)
or die "Failed to create template processor: $Template::ERROR";
# Process the source template, to generate the output.
$tt->process($0,
{ },
"$0.out")
or die "Failed to process template foo: " . $tt->error();