You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A workaround I've found is to call $doc->serialize instead. But this begs the question as to why the object stringifies at all if it produces broken code.
Notes
I investigated, and apparently the PPI::Token::HereDoc object only sets ->{content} to the first line. It should set it to the entire heredoc contents to fix the issue.
Possible other fix is to do use overload '""' => 'serialize' instead of => 'content'.
The text was updated successfully, but these errors were encountered:
Problem description
Stringifying the
PPI::Document
object (same as calling->content()
on it) strips out the content of heredocs, giving back an un-parseable document.Example code:
Which prints:
Expected to print:
From what I've seen, the other tokens in the code are preserved, it's just heredocs that I found were affected.
Workaround
A workaround I've found is to call
$doc->serialize
instead. But this begs the question as to why the object stringifies at all if it produces broken code.Notes
I investigated, and apparently the
PPI::Token::HereDoc
object only sets->{content}
to the first line. It should set it to the entire heredoc contents to fix the issue.Possible other fix is to do
use overload '""' => 'serialize'
instead of=> 'content'
.The text was updated successfully, but these errors were encountered: