Re: Windows line endings (was: no subject)

Andy Wardley <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.template-toolkit
Message-ID <[email protected]>
On 04/04/2012 14:03, Alex Zwinge wrote:
 > The issue is that when the template is rendered and outputted to a
 > file tt seems like it's adding a bunch of extra line breaks between
 > the lines. So for example if in my template I have

These might help:

http://tt2.org/docs/manual/Config.html#section_PRE_CHOMP_POST_CHOMP
http://tt2.org/docs/manual/Syntax.html#section_Chomping_Whitespace

(on second thoughts, maybe not...)

 > The content in question is static, not perl/tt code.

Ah right, it doesn't sound like the PRE_CHOMP/POST_CHOMP is the answer 
then.  If the problem is happening with static text then it suggests a 
problem with your line endings.  This appears to be the same problem:

http://mail.template-toolkit.org/pipermail/templates/2009-September/010927.html

There's a work-around posted there but it would be good to get to the 
root cause of the problem.  It might be as simple as adding the BINMODE 
option.

     my $tt = Template->new( BINMODE => 1 );

That might be enough to coerce Perl into saving the correct line endings 
into the output file.  Try that and see if it makes any difference.

Cheers
Andy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.