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?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.