my $code = <<CODE ;
${indent}my \@data = $data_init ;
-${indent}while( defined( my \$data = shift \@data ) ) {
+${indent}while( \@data ) {
+${indent} my \$data = shift \@data ;
${indent} if ( ref \$data eq 'ARRAY' ) {
${indent} push \@data, \@{\$data} ;
${indent} next ;
# loop all nested chunks and the text separating them
- while( $template =~ m{$self->{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
# 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