Perl::Critic::Policy::Documentation::ProhibitVerbatimMarkup3pm
Unexpanded c<> etc markup in pod verbatim paras
Overview
This policy is part of the "Perl::Critic::Pulp" add-on. It reports POD verbatim paragraphs which contain markup like B<> or C<>. That markup will appear literally in the formatted output where you may have meant fontification.
=head1 SOME THINGParagraph of text introducing an example,# call the C<foo> function # bad&foo();
This is purely cosmetic so this policy is low severity and under the "cosmetic" theme (see "POLICY THEMES" in Perl::Critic). Normally it means one of two things,
- •
-
You want markup -- it should be a plain paragraph not a verbatim indented one. An
"=over"can be used for indentation if desired.
- •
-
You want verbatim -- replace the markup with an ascii approximation like
"func()"or perhaps"*bold*"or"_underline_".
Don't forget that a verbatim paragraph extends to the next blank line and includes unindented lines until then too (see "Pod Definitions" in perlpodspec). If you forget the blank line then the verbatimness continues
=pod$some->sample;code();And this was I<meant> to be plain text. # bad
Markup Forms
The check for markup is unsophisticated. Any of the POD specified "I<" "C<" etc is taken to be markup, plus "J<" of "Pod::MultiLang".
I< # badB< # badC< # badL< # badE< # badF< # badS< # badX< # badZ< # badJ< # bad, for Pod::MultiLang
It's possible a "<" might be something mathematical like "X<Y", but in practice spaces "X < Y" or lower case letters are more common (and are ok).
"DB<1>" style sample Perl debugger output is exempted (see perldebug). It's uncommon, but not likely to have intended "B<>" bold.
DB<123> dump b # ok
Disabling
If a verbatim paragraph is showing how to write POD markup then you can add an "=for" to tell "ProhibitVerbatimMarkup" to allow it. This happens most often in documentation for modules which themselves operate on POD markup.
=for ProhibitVerbatimMarkup allow nextblah blah E<gt> etc=for ProhibitVerbatimMarkup allow next 2Two verbatims of C<code>or B<bold> etc
The usual no critic works too,
## no critic (ProhibitVerbatimMarkup)
But the annotation must be before any "__END__" token, and if the POD is after an "__END__" token then "Perl::Critic" 1.112 up is required. An "=for" has the advantage of being together with the exception.
As always if you don't care at all about this at all then disable "ProhibitVerbatimMarkup" from your .perlcriticrc in the usual way (see "CONFIGURATION" in Perl::Critic),
[-Documentation::ProhibitVerbatimMarkup]
Home page
http://user42.tuxfamily.org/perl-critic-pulp/index.html
Releases
4 releases since Debian 10 (Buster); the text changed 1 time.