An @INC filter (a subroutined returned by a subroutine in @INC) could
be an lvalue sub that returns a magical scalar for the status. We
need to account for that.
If we don’t call get-magic (FETCH), we’ll get the last value assigned
to or returned from that scalar.
if (count > 0) {
SV *out = POPs;
+ SvGETMAGIC(out);
if (SvOK(out)) {
status = SvIV(out);
}
use Config;
use Filter::Util::Call;
-plan(tests => 152);
+plan(tests => 153);
unshift @INC, sub {
no warnings 'uninitialized';
return $done = 1;
} or die;
is ${$::{the_scalar}}, 98732, 'tying $_ in inc filter';
+@lines = ('$::the_scalar', '= "12345"');
+tie my $ret, "main", 1;
+do sub :lvalue {
+ return 0 unless @lines;
+ $_ = shift @lines;
+ return $ret;
+} or die;
+is ${$::{the_scalar}}, 12345, 'returning tied val from inc filter';
# d8723a6a74b2c12e wasn't perfect, as the char * returned by SvPV*() can be