Hello,
using ActiveState Perl on WinXP I saw similar behavior. Had no time to
dwelve deeper to find the root cause of this, I am using workaround like
this:
use Template;
my $tt = Template->new({
LOAD_TEMPLATES => [
CrLfStripper->new({ INCLUDE_PATH => '.' }),
],
});
$tt->process('my_template')
|| die $tt->error;
package CrLfStripper;
{
use base 'Template::Provider';
sub _template_content {
my ($self,$path) = @_;
my ($data,$error,$mod_date) =
$self->SUPER::_template_content($path);
# strip CR from CR+LF pairs
$data =~ tr{\r}{}d;
return wantarray
? ($data,$error,$mod_date)
: $data;
}
}
CrLfStripper just subclasses Template::Provider with something that cuts
CR characters out of template text. This way you can use both CRLF and
LF-only templates.
-- regards, Roman
Torben Jensen napsal(a):
> I have been playing with htmlpp (by imatix) since 1996, and just
> discovered the Termplate Toolkit (which is htmlpp on steroids).
>
> But since I am a windows user, I have discovered one strange thing. It
> seems like TT outputs an extra line feed at the end of each line in
> the template IF the template is saved in DOS/Windows format. (with
> \r\n line endings)
>
> If the template is saved in UNIX format, everything works as expected.
>
> How can I avoid this behavior ? Don't want to remember to set UNIX
> format every time I create a template.
> Did not find any directive for it.
>
> _______________________________________________
> templates mailing list
> [email protected]
> http://mail.template-toolkit.org/mailman/listinfo/templates
>
>
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates