Skip to content

fix(perl): count POD that opens with a heading - #788

Open
LuisFigueroaG wants to merge 1 commit into
boyter:masterfrom
LuisFigueroaG:fix/perl-pod-headings
Open

LuisFigueroaG wants to merge 1 commit into
boyter:masterfrom
LuisFigueroaG:fix/perl-pod-headings

Conversation

@LuisFigueroaG

Copy link
Copy Markdown
Contributor

In Perl, a POD command at the start of a statement starts a POD block that runs until =cut. scc only recognised =pod, but most POD starts with a heading (=head1 NAME), so all of that documentation was counted as code.

This adds =head1 to =head4 as openers that close on =cut, and regenerates processor/constants.go. On the system Perl library on macOS (1,254 files), code goes from 568,483 to 486,160 lines and comments from 56,449 to 158,230.

There's one limitation, which =pod already has: openers aren't tied to the start of a line, so a regex like m/^=head1 NAME/ in POD-parsing code also opens a block. That happened in 6 of those 1,254 files, all of them Pod tooling. I stopped at the headings because shorter commands like =item and =over would also match code like $x=items.

Tests are in processor/workers_perl_test.go: blocks that start with a heading fail on master, and another test checks that =pod still works. ./test-all.sh passes.

I explicitly license this contribution under the MIT licence.

@pr-insights pr-insights Bot added M/complexity Normal or medium complexity M/size Normal or medium sized change labels Oct 13, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

M/complexity Normal or medium complexity M/size Normal or medium sized change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant