@@ -202,7 +202,7 @@ sub __TOKENIZER__on_char {
202202 }
203203
204204 # Suck in the HEREDOC
205- $token -> {_heredoc } = [] ;
205+ $token -> {_heredoc } = \ my @heredoc ;
206206 my $terminator = $token -> {_terminator } . " \n " ;
207207 while ( defined ( my $line = $t -> _get_line ) ) {
208208 if ( $line eq $terminator ) {
@@ -215,7 +215,7 @@ sub __TOKENIZER__on_char {
215215 }
216216
217217 # Add the line
218- push @{ $token -> { _heredoc }} , $line ;
218+ push @heredoc , $line ;
219219 }
220220
221221 # End of file.
@@ -226,19 +226,19 @@ sub __TOKENIZER__on_char {
226226 # compile but is easy to detect) or if the here-doc block was just not
227227 # terminated at all (which Perl would fail to compile as well).
228228 $token -> {_terminator_line } = undef ;
229- if ( @{ $token -> { _heredoc }} and defined $token -> { _heredoc } [-1] ) {
229+ if ( @heredoc and defined $heredoc [-1] ) {
230230 # See PPI::Tokenizer, the algorithm there adds a space at the end of the
231231 # document that we need to make sure we remove.
232232 if ( $t -> {source_eof_chop } ) {
233- chop $token -> { _heredoc } [-1];
233+ chop $heredoc [-1];
234234 $t -> {source_eof_chop } = ' ' ;
235235 }
236236
237237 # Check if the last line of the file matches the terminator without
238238 # newline at the end. If so, remove it from the content and set it as
239239 # the terminator line.
240- $token -> {_terminator_line } = pop @{ $token -> { _heredoc }}
241- if $token -> { _heredoc } [-1] eq $token -> {_terminator };
240+ $token -> {_terminator_line } = pop @heredoc
241+ if $heredoc [-1] eq $token -> {_terminator };
242242 }
243243
244244 # Set a hint for PPI::Document->serialize so it can
0 commit comments