p5-Text-Xslate
p5-Text-Xslate copied to clipboard
Funky Ref Count Issues when Coro is loaded and verbose=>2
Check this out:
: perl -e 'use Text::Xslate; print Text::Xslate->new( verbose=>2 )->render_string(q[<: my $foo="bar"; $foo.invalid(); :> HELLO WORLD])'
Text::Xslate: Undefined method invalid called for 'bar' (<string>:1) at -e line 1.
----------------------------------------------------------------------------
<: my $foo="bar"; $foo.invalid(); :> HELLO WORLD
----------------------------------------------------------------------------
Text::Xslate: Use of nil to print (<string>:1) at -e line 1.
----------------------------------------------------------------------------
<: my $foo="bar"; $foo.invalid(); :> HELLO WORLD
----------------------------------------------------------------------------
HELLO WORLD
exit code of above is 0
(ok).
And now all I do is add Coro:
: perl -e 'use Coro; use Text::Xslate; print Text::Xslate->new( verbose=>2 )->render_string(q[<: my $foo="bar"; $foo.invalid(); :> HELLO WORLD])'
Text::Xslate: Undefined method invalid called for 'bar' (<string>:1) at -e line 1.
----------------------------------------------------------------------------
<: my $foo="bar"; $foo.invalid(); :> HELLO WORLD
----------------------------------------------------------------------------
Text::Xslate: Use of nil to print (<string>:1) at -e line 1.
----------------------------------------------------------------------------
<: my $foo="bar"; $foo.invalid(); :> HELLO WORLD
----------------------------------------------------------------------------
Attempt to free unreferenced scalar: SV 0x1501648, Perl interpreter: 0x103b010 at -e line 1.
Attempt to free unreferenced scalar: SV 0x1501648, Perl interpreter: 0x103b010 during global destruction.
exit code of above is 2
(NOT ok).
I don't know that there is anything to do about this in Xslate. But if there is I thought I'd report it. I prefer to assume that Coro is the culprit.
Note that verbose=>1
with Coro also has issues:
: perl -e 'use Coro; use Text::Xslate; print Text::Xslate->new( verbose=>1 )->render_string(q[<: my $foo="bar"; $foo.invalid(); :> HELLO WORLD])'
Text::Xslate: Undefined method invalid called for 'bar' (<string>:1) at -e line 1.
----------------------------------------------------------------------------
<: my $foo="bar"; $foo.invalid(); :> HELLO WORLD
----------------------------------------------------------------------------
HELLO WORLDAttempt to free unreferenced scalar: SV 0x291c648, Perl interpreter: 0x2456010 during global destruction.
But in this case the exit code is 0
, it just comes with that nice ref count issue.