xslate / p5-Text-Xslate

Scalable template engine for Perl5
https://metacpan.org/release/Text-Xslate
Other
121 stars 47 forks source link

Fix case that input is '0' #113

Closed syohex closed 10 years ago

syohex commented 10 years ago

If input is only string '0', then loop condition is false and loop body is not evaluated. This loop should test whether $_ is empty string, not $_ is false.

Output of #111 is

% perl -MText::Xslate -E '$t=Text::Xslate->new; $t->render_string("1") eq "1" ? say "OK" : say "ERR"'
OK
% perl -MText::Xslate -E '$t=Text::Xslate->new; $t->render_string("0") eq "0" ? say "OK" : say "ERR"'
OK

This fix is related to #111, #112.

Please see this patch.

gfx commented 10 years ago

Thanks!