Pod::Simple line accounting drops replacement comments for multi-line POD
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
Research direction
Start in parse_string_document and related parsing paths, then inspect the callback positions produced for multi-line POD, consecutive POD blocks, blank lines, and code transitions. Add focused tests for code_handler line positions and replacement-line counts, then run t/11_replace_with_comments.t and the Pod::Strip v1.100 suite on both JVM and interpreter backends.
Written by the indexing model from the issue text.
Description
Summary
PerlOnJava's bundled Pod::Simple reports incorrect source line positions for multi-line POD blocks. This causes Pod::Strip v1.100 to emit too few replacement comments when replace_with_comments is enabled.
CPAN evidence
- CPAN run:
20260918-141920-96054 - Distribution:
Pod::Stripv1.100 - System Perl: PASS — 3 files, 7 tests
- PerlOnJava: FAIL — 1/3 test programs, 1/7 reported subtests
- Both JVM and interpreter backends reproduce the failure
The failing test is t/11_replace_with_comments.t. It parses source containing two multi-line POD blocks and expects one # stripped POD comment for each source line removed from the output.
PerlOnJava emits one replacement comment for each POD block. The expected output contains seven comments for the first block and five for the second, while the actual output contains only one for each block.
Root cause
Pod::Strip installs a Pod::Simple code_handler that receives the next source-code line number as its second argument. It uses that line number to emit the appropriate number of # stripped POD lines:
if ($code_line + 1 < $next_code_line) {
print "# stripped POD\n" x ($next_code_line - $code_line - 1);
}
Under PerlOnJava, the callback line positions do not account for all lines in the removed POD block. The callback therefore believes that the next code line is immediately after the previous code line and emits only one marker per POD section.
This is a Pod::Simple source-position compatibility problem, not a defect in Pod::Strip.
Reproduction
Run the Pod::Strip v1.100 test suite under PerlOnJava. t/00-compile.t and t/10_strip.t pass, while t/11_replace_with_comments.t fails its pod stripped comparison.
A minimal reproducer should parse code containing a multi-line POD block through Pod::Simple with a code_handler, then verify that the callback’s reported line number includes every source line consumed by the POD block.
Expected behavior
For a POD block spanning multiple source lines, Pod::Simple must report the correct next code line to code_handler, matching standard Perl. Consumers that preserve line numbering should then be able to emit one placeholder line per removed source line.
Requested fix
- Correct
Pod::Simpleline accounting for multi-line POD sections inparse_string_documentand related parsing paths. - Preserve accurate callback positions across consecutive POD blocks, blank lines, and transitions between POD and code.
- Add focused project-owned tests for
code_handlerline positions and replacement-line counts. - Rerun
Pod::Stripv1.100 on both JVM and interpreter backends.
- Dominant language
- Perl
- Stars
- 64
- Forks
- 6
- Avg merge
- 5h 25m
- Merged PRs (30d)
- 157
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from fglock/PerlOnJava
-
area:cpan-port area:unicode bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
fglock/PerlOnJava#1341 ·
-
area:cpan-port bug
Difficulty 4/5 3-5 days Newbie friendliness 44/100
fglock/PerlOnJava#1459 ·
-
area:cpan-port bug
Difficulty 3/5 1-2 days Newbie friendliness 72/100
fglock/PerlOnJava#1457 ·
-
bug high-impact
Difficulty 3/5 1-2 days Newbie friendliness 67/100
fglock/PerlOnJava#1456 · 1 comment ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 72/100
fglock/PerlOnJava#1455 ·
All issues in fglock/PerlOnJava
Similar issues
-
1.severity: security
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
api7/lua-resty-saml#63 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100