Skip to content

Commit

Permalink
close #95; do not use chomp() in modules
Browse files Browse the repository at this point in the history
  • Loading branch information
gfx committed Nov 16, 2013
1 parent 06487ea commit 92c7387
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Text/Xslate/Parser.pm
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ sub auto_chomp {
# \n <:- ... :>
# ^^^^^^^^^^
$p->[1] = '';
$nl += chomp ${$s_ref};
$nl += (${$s_ref} =~ s/\n\z//xms);
}
return $nl;
}
Expand Down Expand Up @@ -412,7 +412,7 @@ sub preprocess {
if($s =~ /\A \s* [}] \s* \z/xms){
$code .= $s;
}
elsif(chomp $s) {
elsif($s =~ s/\n\z//xms) {
$code .= qq{$s\n};
}
else {
Expand Down
23 changes: 23 additions & 0 deletions t/900_bugs/039_issue95.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!perl
use strict;
use warnings;

use Test::More;

use Text::Xslate::Syntax::Kolon;

{
my $content = <<'T';
: cascade bar {
: hoge => 'fuga'
: }
T
my $parser = Text::Xslate::Syntax::Kolon->new();

local $/;
$parser->parse($content);
}

pass;

done_testing;

0 comments on commit 92c7387

Please sign in to comment.