Skip Menu |

This queue is for tickets about the Template-Toolkit CPAN distribution.

Report information
The Basics
Id: 60083
Status: resolved
Priority: 0/
Queue: Template-Toolkit

People
Owner: Nobody in particular
Requestors: nick [...] leverton.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.22
Fixed in: (no value)



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();
Ticket migrated to github as https://github.com/abw/Template2/issues/97