I am having problems with the most recent version of
Test::Spelling. One tends now to get the following error:
Modification of a read-only value attempted at /usr/share/perl5/Test/Spelling.pm line 223, <DATA> line 1002.
Now I am fairly sure I understand what is going on here. In add_stopwords, the 0.11 version had:
for (@_) {
my $word = $_;
$word =~ s/^#?\s*//;
The latest version has
for my $word (@_) {
$word =~ s/^#?\s*//;
So in the latest version we are modifying an element of the array of stopwords (which will tend to be an array of constants). In the old version the element was copied so there was no problem.
Now what is the real problem here? I thought the distinction between using $_ directly and copying it is a bit obscure, especially for non-critical code. I submitted a patch that does a non-modifying extraction via regex: rt://68471 but the module author simply proposes reverting. There is a comment in the code promising something more modern - so why not now. Also why does the code need to strip off spaces - surely that will happen anyway? Can someone explain why the problem goes away when I try to debug it?