Subject: | Code tries to modify constants |
Sometimes, in particular when using Build, I get the following error.
Modification of a read-only value attempted at
/usr/share/perl5/Test/Spelling.pm line 223, <DATA> line 1002.
If I try to debug the code, the issue goes away. However
I can see a very plausible patch, and I attach it. The bug was also
reported to Debian as follows.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=627963
Subject: | dont_modify_constants.patch |
--- a/lib/Test/Spelling.pm
+++ b/lib/Test/Spelling.pm
@@ -217,13 +217,9 @@
sub add_stopwords {
for my $word (@_) {
- # XXX: the processing this performs is to support "perl t/spell.t 2>>
- # t/spell.t" which is bunk. in the near future the processing here will
- # become more modern
- $word =~ s/^#?\s*//;
- $word =~ s/\s+$//;
- next if $word =~ /\s/ or $word =~ /:/;
- $Pod::Wordlist::Wordlist{$word} = 1;
+ if ($word =~ m{\A\#?\s*([^\s\:]+)\s*\z}xms) {
+ $Pod::Wordlist::Wordlist{$1} = 1;
+ }
}
}