This was caused by change 27323/
f7877b281b4, which changes the way
globs are stored in SVs. This patch teaches Perl_magic_setmglob (which
resets the match position after an assignment) about globs. What was
happening was that the globness was turned off (with the type still as
PVGV), which essentially turned the variable into a strange empty
string. Data::Dumper, seeing a PVGV, assumes the string form is at
least 1 char (which should always be the case), and ends up reading
past the end of the string if it is blank.
PERL_ARGS_ASSERT_MAGIC_SETMGLOB;
PERL_UNUSED_CONTEXT;
mg->mg_len = -1;
- SvSCREAM_off(sv);
+ if (!isGV_with_GP(sv))
+ SvSCREAM_off(sv);
return 0;
}
use warnings;
require './test.pl';
-plan( tests => 181 );
+plan( tests => 182 );
# type coersion on assignment
$foo = 'foo';
is($str, '', "RT #60954 anon glob stringification should be empty");
}
+# [perl #71254] - Assigning a glob to a variable that has a current
+# match position. (We are testing that Perl_magic_setmglob respects globs'
+# special used of SvSCREAM.)
+{
+ $m = 2; $m=~s/./0/gems; $m= *STDERR;
+ is(
+ "$m", "*main::STDERR",
+ '[perl #71254] assignment of globs to vars with pos'
+ );
+}
+
__END__
Perl
Rules