Pod::Checker(3pm)
π Pod::Checker(3pm) π
okay so bestie, this page comes from the Perl Programmers Reference Guide, and the manual name is literally Pod::Checker(3pm). We're checking POD docs for syntax errors. Periodt. π
π NAME π
Pod::Checker β check pod documents for syntax errors
β¨ SYNOPSIS β¨
use Pod::Checker;
$syntax_okay = podchecker($filepath, $outputpath, %options);
my $checker = Pod::Checker->new(%options);
$checker->parse_from_file($filepath, \*STDERR);
π OPTIONS/ARGUMENTS π
$filepath is the input POD to read, and $outputpath is where to write POD syntax error messages. Either argument can be a scalar indicating a file-path, or else a reference to an open filehandle. If unspecified, the input-file defaults to \*STDIN, and the output-file defaults to \*STDERR. π«Ά
podchecker()
This function can take a hash of options:
-warnings => valβ Turn warnings on/off.valis usually1for on, but higher values trigger additional warnings. See "Warnings". β¨-quiet => valβ Ifvalis true, do not print any errors/warnings. π€«
πΈ DESCRIPTION πΈ
podchecker will perform syntax checking of Perl5 POD format documentation. No cap.
Curious/ambitious users are welcome to propose additional features they wish to see in Pod::Checker and podchecker and verify that the checks are consistent with perlpod. Like, come through with ideas, bestie. π¦
The following checks are currently performed:
- Unknown
'=xxxx'commands, unknown'X<...>'interior-sequences, and unterminated interior sequences. - Check for proper balancing of
=beginand=end. The contents of such a block are generally ignored, i.e. no syntax checks are performed. - Check for proper nesting and balancing of
=over,=itemand=back. - Check for same nested interior-sequences (e.g.
L<...L<...>...>). - Check for malformed or non-existing entities
E<...>. - Check for correct syntax of hyperlinks
L<...>. Seeperlpodfor details. - Check for unresolved document-internal links. This check may also reveal misspelled links that seem to be internal links but should be links to something else. π
π©Ί DIAGNOSTICS π©Ί
Errors
empty =headnβ A heading (=head1or=head2) without any text? That ain't no heading!=over on line N without closing =backYou forgot a '=back' before '=headN'=over is the last thing in the document?!β The=overcommand does not have a corresponding=backbefore the next heading (=head1or=head2) or the end of the file.'=item' outside of any '=over'=back without =overβ An=itemor=backcommand has been found outside a=over/=backblock.Can't have a 0 in =over Nβ You need to indent a strictly positive number of spaces, not 0.=over should be: '=over' or '=over positive_number'β Either have an argumentless=over, or have its argument be a strictly positive number.=begin TARGET without matching =end TARGETβ A=begincommand was found that has no matching=endcommand.=begin without a target?β A=begincommand was found that is not followed by the formatter specification.=end TARGET without matching =begin.β A standalone=endcommand was found.'=end' without a target?β'=end'directives need to have a target, just like=begindirectives.'=end TARGET' is invalid.β TARGET needs to be one word.=end CONTENT doesn't match =begin TARGETβ CONTENT needs to match=begin's TARGET.=for without a target?β There is no specification of the formatter after the=forcommand.unresolved internal link NAMEβ The given link to NAME does not have a matching node in the current POD. This also happened when a single word node name is not enclosed in"".Unknown directive: CMDβ An invalid POD command has been found. Valid are=head1,=head2,=head3,=head4,=over,=item,=back,=begin,=end,=for,=pod,=cut.Deleting unknown formatting code SEQβ An invalid markup command has been encountered. Valid are:B<>,C<>,E<>,F<>,I<>,L<>,S<>,X<>,Z<>.Unterminated SEQ<> sequenceβ An unclosed formatting code.An E<...> surrounding strange contentβ The STRING found cannot be interpreted as a character entity.An empty E<>An empty "L<>"An empty X<>β There needs to be content inside E, L, and X formatting codes.Spurious text after =pod / =cutβ The commands=podand=cutdo not take any arguments.=back doesn't take any parameters, but you said =back ARGUMENTβ The=backcommand does not take any arguments.=pod directives shouldn't be over one line long! Ignoring all N lines of contentβ Self explanatory.=cut found outside a pod block.β A=cutdirective found in the middle of non-POD.Invalid =encoding syntax: CONTENTβ Syntax error in=encodingdirective.
Warnings
These may not necessarily cause trouble, but indicate mediocre style. Like, not a full crisis, but definitely a vibe check. π
nested commands CMD<...CMD<...>...>β Two nested identical markup commands have been found. Generally this does not make sense.multiple occurrences (N) of link target nameβ The POD file has some=itemand/or=headcommands that have the same text. Potential hyperlinks to such a text cannot be unique then. This warning is printed only with warning level greater than one.line containing nothing but whitespace in paragraphβ There is some whitespace on a seemingly empty line. POD is very sensitive to such things, so this is flagged. vi users switch on the list option to avoid this problem.=item has no contentsβ There is a list=itemthat has no text contents. You probably want to delete empty items.You can't have =items (as at line N) unless the first thing after the =over is an =itemβ A list introduced by=overstarts with a text or verbatim paragraph, but continues with=items. Move the non-item paragraph out of the=over/=backblock.Expected '=item EXPECTED VALUE'Expected '=item *'Possible =item type mismatch: 'x' found leading a supposed definition =itemβ A list started with e.g. a bullet-like=itemand continued with a numbered one. This is obviously inconsistent. For most translators the type of the first=itemdetermines the type of the list.You have '=item x' instead of the expected '=item N'β Erroneous numbering of=itemnumbers; they need to ascend consecutively.Unknown E content in E<CONTENT>β A character entity was found that does not belong to the standard ISO set or the POD specialsverbarandsol. Currently, this warning only appears if a character entity was found that does not have a Unicode character. This should be fixed to adhere to the original warning.empty =over/=back blockβ The list opened with=overdoes not contain anything.empty section in previous paragraphβ The previous section (introduced by a=headcommand) does not contain any valid content. This usually indicates that something is missing. Note: A=head1followed immediately by=head2does not trigger this warning.Verbatim paragraph in NAME sectionβ The NAME section (=head1 NAME) should consist of a single paragraph with the script/module name, followed by a dash `-' and a very short description of what the thing is good for.=headn without preceding higher levelβ For example if there is a=head2in the POD file prior to a=head1.A non-empty Z<>β TheZ<>sequence is supposed to be empty. Caveat: this issue is detected in Pod::Simple and will be flagged as an ERROR by any client code; any contents ofZ<...>will be disregarded, anyway.
Hyperlinks
There are some warnings with respect to malformed hyperlinks:
ignoring leading/trailing whitespace in linkβ There is whitespace at the beginning or the end of the contents ofL<...>.alternative text/node '%s' contains non-escaped | or /β The characters|and/are special in theL<...>context. Although the hyperlink parser does its best to determine which/is text and which is a delimiter in case of doubt, one ought to escape these literal characters like this:
/ E<sol>
| E<verbar>
Note that the line number of the error/warning may refer to the line number of the start of the paragraph in which the error/warning exists, not the line number that the error/warning is on. This bug is present in errors/warnings related to formatting codes. This should be fixed. π
π RETURN VALUE π
podchecker returns the number of POD syntax errors found or -1 if there were no POD commands at all found in the file.
π EXAMPLES π
See "SYNOPSIS".
π§ SCRIPTS π§
The podchecker script that comes with this distribution is a lean wrapper around this module. See the online manual with
podchecker -help
podchecker -man
π INTERFACE π
okay so while it's checking, this module is lowkey collecting document properties β e.g. the nodes for hyperlinks (=headX, =item) and index entries (X<>). POD translators can use this feature to syntax-check and get the nodes in a first pass before actually starting to convert. Is that not iconic? It is expensive in terms of execution time, but it allows for very robust conversions. π
Since v1.24 the Pod::Checker module uses only the poderror method to print errors and warnings. The summary output (e.g. "Pod syntax OK") has been dropped from the module and has been included in podchecker (the script). This allows users of Pod::Checker to control completely the output behavior. Users of podchecker (the script) get the well-known behavior. π«Ά
v1.45 inherits from Pod::Simple as opposed to all previous versions inheriting from Pod::Parser.
β οΈ Do not usePod::Simple's interface when usingPod::Checkerunless it is documented somewhere on this page. I repeat, DO NOT USE POD::SIMPLE'S INTERFACE. π
Here's the full list of overrides to Pod::Simple, primarily to make Pod::Coverage happy β yes, all of them, no skips:
end_Bend_Cend_Documentend_Fend_Iend_Lend_Paraend_Send_Xend_fcodeend_forend_headend_head1end_head2end_head3end_head4end_itemend_item_bulletend_item_numberend_item_texthandle_pod_and_cuthandle_texthandle_whitelinehyperlinkscreamstart_Bstart_Cstart_Datastart_Fstart_Istart_Lstart_Parastart_Sstart_Verbatimstart_Xstart_fcodestart_forstart_headstart_head1start_head2start_head3start_head4start_item_bulletstart_item_numberstart_item_textstart_overstart_over_blockstart_over_bulletstart_over_emptystart_over_numberstart_over_textwhine
Pod::Checker->new( %options )
Returns a reference to a new Pod::Checker object that inherits from Pod::Simple and is used for calling the required methods later. The following options are recognized:
-warnings => numβ Print warnings ifnumis true. The higher the value ofnum, the more warnings are printed. Currently there are only levels 1 and 2.-quiet => numβ Ifnumis true, do not print any errors/warnings. This is useful whenPod::Checkeris used to munge POD code into plain text from within POD formatters.
$checker->poderror( @args )
$checker->poderror( {%opts}, @args )
Internal method for printing errors and warnings. If no options are given, it simply prints "@_". The following options are recognized and used to form the output:
-msgβ A message to print prior to@args.-lineβ The line number the error occurred in.-fileβ The file (name) the error occurred in. Defaults to the name of the current file being processed.-severityβ The error level, should be'WARNING'or'ERROR'.
Here are the rest of the methods, bestie:
$checker->num_errors()β Set (if argument specified) and retrieve the number of errors found.$checker->num_warnings()β Set (if argument specified) and retrieve the number of warnings found.$checker->name()β Set (if argument specified) and retrieve the canonical name of POD as found in the=head1 NAMEsection.$checker->node()β Add (if argument specified) and retrieve the nodes (as defined by=headXand=item) of the current POD. The nodes are returned in the order of their occurrence. They consist of plain text, each piece of whitespace is collapsed to a single blank.$checker->idx()β Add (if argument specified) and retrieve the index entries (as defined byX<>) of the current POD. They consist of plain text, each piece of whitespace is collapsed to a single blank.$checker->hyperlinks()β Retrieve an array containing the hyperlinks to things outside the current POD (as defined byL<>).
Each is an instance of a class with the following methods:
π the hyperlink object's methods π
line()β Returns the approximate line number in which the link was encountered.type()β Returns the type of the link; one of:"url"for things like"http://www.foo","man"for man pages, or"pod".page()β Returns the linked-to page or url.node()β Returns the anchor or node within the linked-to page, or an empty string ("") if none appears in the link.
πΈ AUTHOR πΈ
Please report bugs using <http://rt.cpan.org>. π
- Brad Appleton
<bradapp@enteract.com>(initial version) - Marek Rouchal
<marekr@cpan.org> - Marc Green
<marcgreen@cpan.org>(port toPod::Simple) - Ricardo Signes
<rjbs@cpan.org>(more porting toPod::Simple) - Karl Williamson
<khw@cpan.org>(more porting toPod::Simple)
Based on code for Pod::Text::pod2text() written by Tom Christiansen <tchrist@mox.perl.com>. π«‘
π and that's the tea! This page is from perl v5.42.3, dated 2026-11-03 β Pod::Checker(3pm) out. Mwah! πβ¨
π¦ where this page comes from
- alpine 3.24: perl-doc 5.42.3-r0 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms