Repository navigation
Description
Found while fixing the keyword-rosetta corpus's perl shell (gitgalaxy#2669 A.3).
The rule
"doc": re.compile(r"^=(?:pod|head[1-6]|item|over|back|cut|begin|end|encoding|for)\b", re.M)=cut is in the same alternation as the openers, and nothing pairs them. A correctly written
POD block therefore always counts at least 2 doc hits:
=pod
some documentation
=cut # <- counted as a second, independent doc hitThis is exactly the shape #2658 fixed for python (""" opener and closer counted separately with
no pairing) — resolved there by matching the full delimited span as one bounded hit.
Differential (real scan, full_precision, engine main @ 3ac9182)
keyword-rosetta data/perl/main.pl, one line added and nothing else changed:
| main.pl | doc |
|---|---|
=pod … (unterminated) |
1 |
=pod … =cut |
2 |
Every other recorded signal is identical across the two scans.
Why it is not just a counting nit
The corpus's perl shell had been left with an unterminated =pod — the only way to get
doc = 1 — and that turned out to be masking a much larger effect, because
detector.py (~L3042, the #2239 POD strip) blanks from a POD opener to the next =cut, or to
end of file when there is none:
m_end = pod_end.search(safe_code, m_start.start())
end_idx = m_end.end() if m_end else len(safe_code)So the whole of main.pl was blanked for structural scanning. Closing the block restores it:
| main.pl | before (=pod unterminated) |
after (=pod … =cut) |
|---|---|---|
avg_func_loc |
0.0 | 6.75 |
avg_func_complexity |
0.0 | 0.75 |
func_internal_density |
0.0 | 0.111 |
structural_mass |
104.52 | 11.9 (siblings: 8.3 / 11.44 / 9.36) |
Corpus-wide that was functions_found 9 vs a 13 median for perl, and it is the direct cause of
perl's depressed avg_func_loc (-27%), avg_func_complexity (-38%), max_func_complexity
(-50%), func_complexity_gini (-53%), func_internal_density (-49%) and control_flow_ratio
(-40%) cells, plus structural_mass +212%.
The corpus side is fixed (the POD block is now closed). What is left here is the doc double-count.
Suggested fix
Same shape as #2658: pair the opener with its =cut and count the span once. Note the
end-of-file fallback above is a second, related question — a file with an unterminated POD
opener silently loses all structure after it, with no warning; worth deciding whether that
should stay silent.
Cross-repo
- Corpus branch
corpus/decoy-migration-wave2in keyword-rosetta bakes in the current
behaviour (doc: 2), per GATING's "the corpus measures what the engine does". - Ledger entry:
perl-pod-delimiter-double-count. - gitgalaxy#2669 B.1 is collecting the doc-block double-count family (
/**+@paramin
java/groovy/kotlin/php/scala/solidity, apex@author, cobol cobol: doc rule's AUTHOR-vs-ownership collision needs a corpus-side doc line planted before the engine fix (#2659 follow-up) #2661) — this belongs to that
family and should be folded into its single fix shape.
Activity
squid-protocol commentedon Sep 2, 2026
Member of the doc-delimiter family filed as #2672 (Batch B.1 of #2669) — the perl POD case is
=pod/=cutin the same shape as java/groovy/kotlin/php/scala/**+@paramand solidity///+@param. Fix shape and prototype evidence live there; #2672 should close this one with it.