Setting $_ to a copy-on-write scalar in an @INC filter causes the
parser to modify every other scalar sharing the same string buffer.
It needs to be forced to a regular scalar before the parser sees it.
LEAVE_with_name("call_filter_sub");
}
+ if (SvIsCOW(upstream)) sv_force_normal(upstream);
if(!err && SvOK(upstream)) {
got_p = SvPV(upstream, got_len);
if (umaxlen) {
use Config;
use Filter::Util::Call;
-plan(tests => 144);
+plan(tests => 145);
unshift @INC, sub {
no warnings 'uninitialized';
"pass('And return multiple lines');\n",
]] or die;
+@origlines = keys %{{ "1\n+\n2\n" => 1 }};
+@lines = @origlines;
+do \&generator or die;
+is $origlines[0], "1\n+\n2\n", 'ink filters do not mangle cow buffers';
+
# d8723a6a74b2c12e wasn't perfect, as the char * returned by SvPV*() can be
# a temporary, freed at the next FREETMPS. And there is a FREETMPS in
# pp_require