From: Uri Guttman Date: Wed, 14 Jan 2009 05:41:38 +0000 (-0500) Subject: fixed bug in compiled code to handle undef as an allowed value - needs testing X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=52705b1cdbecabbdf8efe04f45e31dde27dbc823;p=urisagit%2FTemplate-Simple.git fixed bug in compiled code to handle undef as an allowed value - needs testing pointed out by bob rogers removed use of $1, $2 in parsing chunks in the compiler. pointed out by bobbie fox --- diff --git a/lib/Template/Simple.pm b/lib/Template/Simple.pm index 165f132..15d3dae 100644 --- a/lib/Template/Simple.pm +++ b/lib/Template/Simple.pm @@ -144,8 +144,9 @@ sub _compile_chunk { my $code = <{chunk_re}} ) { + while( my( $parsed_name, $parsed_body ) = + $template =~ m{$self->{chunk_re}} ) { # get the pre-match text and compile its scalars and text. append to the code @@ -172,7 +174,9 @@ CODE # compile the nested chunk and append to the code - $code .= $self->_compile_chunk( $1, $2, $indent ) ; + $code .= $self->_compile_chunk( + $parsed_name, $parsed_body, $indent + ) ; # chop off the pre-match and the chunk