Pod::Checker(3perl)

πŸ’– NAME πŸ’–

Pod::Checker β€” bestie, this is the module that checks your pod documents for syntax errors. That's it, that's the whole job, and it absolutely ate. πŸ’…


✨ SYNOPSIS ✨

use Pod::Checker;

$syntax_okay = podchecker($filepath, $outputpath, %options);

my $checker = Pod::Checker->new(%options);
$checker->parse_from_file($filepath, \*STDERR);

🫢 OPTIONS/ARGUMENTS 🫢

okay so $filepath is the input POD you're reading, and $outputpath is where all the POD syntax error messages get written. Both of these args can be either a plain scalar that's a file-path, or a reference to an already-open filehandle. And if you don't specify them? The input-file defaults to \*STDIN and the output-file defaults to \*STDERR. comfy defaults, no stress. 🌸

πŸŽ€ podchecker() πŸŽ€

This function can take a hash of options, and here they are:

  • -warnings => val β€” turns warnings on or off. val is usually 1 for on, but heads up: higher values trigger additional warnings. See "Warnings" for the tea.
  • -quiet => val β€” if val is true, don't print any errors or warnings. silence is golden, periodt. 🀫

πŸ¦‹ DESCRIPTION πŸ¦‹

podchecker will perform syntax checking of Perl5 POD format documentation. that's the mission. 🫑

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.

The following checks are currently performed:

  • Unknown '=xxxx' commands, unknown 'X<...>' interior-sequences, and unterminated interior sequences.
  • Check for proper balancing of =begin and =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, =item and =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<...>. See perlpod for 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 (=head1 or =head2) with literally no text? bestie that ain't no heading! πŸ’€
  • =over on line N without closing =back β€” you opened a list and never closed it.
  • You forgot a '=back' before '=headN' β€” the next heading showed up before you closed your list.
  • =over is the last thing in the document?! β€” the =over command does not have a corresponding =back before the next heading (=head1 or =head2) or the end of the file. it's just vibing there, unclosed. not the move.
  • '=item' outside of any '=over' β€” item with no list to belong to. orphan behavior.
  • =back without =over β€” an =item or =back command has been found outside a =over/=back block.
  • Can't have a 0 in =over N β€” you need to indent a strictly positive number of spaces, not 0. zero is not it.
  • =over should be: '=over' or '=over positive_number' β€” either have an argumentless =over, or have its argument be a strictly positive number. pick a lane. πŸ’…
  • =begin TARGET without matching =end TARGET β€” a =begin command was found that has no matching =end command.
  • =begin without a target? β€” a =begin command was found that is not followed by the formatter specification.
  • =end TARGET without matching =begin. β€” a standalone =end command was found. where did its partner go, bestie?
  • '=end' without a target? β€” =end directives need to have a target, just like =begin directives.
  • '=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 =for command.
  • unresolved internal link NAME β€” the given link to NAME does not have a matching node in the current POD. This also happens when a single word node name is not enclosed in "".
  • Unknown directive: CMD β€” an invalid POD command has been found. The valid ones are =head1, =head2, =head3, =head4, =over, =item, =back, =begin, =end, =for, =pod, =cut. iykyk.
  • Deleting unknown formatting code SEQ β€” an invalid markup command was encountered. Valid ones are: B<>, C<>, E<>, F<>, I<>, L<>, S<>, X<>, Z<>.
  • Unterminated SEQ<> sequence β€” an unclosed formatting code. it started something it couldn't finish. πŸ™ˆ
  • An E<...> surrounding strange content β€” the STRING found cannot be interpreted as a character entity.
  • An empty E<> β€” there needs to be content in there.
  • An empty "L<>" β€” needs content too.
  • An empty X<> β€” yes, E, L and X formatting codes all need content inside them. all three. πŸ’–
  • Spurious text after =pod / =cut β€” the commands =pod and =cut do not take any arguments. no extra luggage.
  • =back doesn't take any parameters, but you said =back ARGUMENT β€” the =back command does not take any arguments. full stop.
  • =pod directives shouldn't be over one line long! Ignoring all N lines of content β€” self explanatory, bestie. one line only.
  • =cut found outside a pod block. β€” a '=cut' directive found in the middle of non-POD. 😬
  • Invalid =encoding syntax: CONTENT β€” syntax error in the =encoding directive.

🌸 Warnings 🌸

These may not necessarily cause trouble, but they indicate mediocre style. not a crime, just... mid.

  • 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 =item and/or =head commands 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. (noted, vi girlies. 🫢)
  • =item has no contents β€” there is a list =item that 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 =over starts with a text or verbatim paragraph, but continues with =items. Move the non-item paragraph out of the =over/=back block.
  • Expected '=item EXPECTED VALUE' β€” the value you gave isn't the one that was expected.
  • Expected '=item *' β€” same energy, expecting a bullet.
  • Possible =item type mismatch: 'x' found leading a supposed definition =item β€” a list started with e.g. a bullet-like =item and continued with a numbered one. This is obviously inconsistent. For most translators the type of the first =item determines the type of the list.
  • You have '=item x' instead of the expected '=item N' β€” erroneous numbering of =item numbers; 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 specials verbar and sol. 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 =over does not contain anything. empty. void. nothing.
  • empty section in previous paragraph β€” the previous section (introduced by a =head command) does not contain any valid content. This usually indicates that something is missing. Note: A =head1 followed immediately by =head2 does 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 =head2 in the POD file prior to a =head1. jumping levels, we don't do that here.
  • A non-empty Z<> β€” the Z<> 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 of Z<...> will be disregarded, anyway.

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 of L<...>.
  • alternative text/node '%s' contains non-escaped | or / β€” the characters | and / are special in the L<...> 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. yes, negative one is a real answer here. πŸ’…


🌈 EXAMPLES 🌈

See "SYNOPSIS". (we already gave you the receipts up top, bestie πŸ‘‘)


🧚 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 πŸ’–

So while it's checking stuff, this module is lowkey collecting document properties β€” like the nodes for hyperlinks (=headX, =item) and the index entries (X<>). POD translators can totally use this feature to syntax-check and grab the nodes in a first pass before they actually start converting. It's expensive in terms of execution time, but bestie, it allows for very robust conversions. Worth it. 🫢

Since v1.24 the Pod::Checker module uses only the poderror method to print errors and warnings. The summary output (like Pod syntax OK) has been dropped from the module and has been included in podchecker (the script). This means users of Pod::Checker get to control completely the output behavior. Users of podchecker (the script) get the well-known behavior. Everybody wins. ✨

v1.45 inherits from Pod::Simple as opposed to all previous versions inheriting from Pod::Parser. So: do not use Pod::Simple's interface when using Pod::Checker unless it is documented somewhere on this page. And I repeat, DO NOT USE POD::SIMPLE'S INTERFACE. 🚨 This is giving very much "read the sign, bestie."

The following list documents the overrides to Pod::Simple, primarily to make Pod::Coverage happy:

  • end_B
  • end_C
  • end_Document
  • end_F
  • end_I
  • end_L
  • end_Para
  • end_S
  • end_X
  • end_fcode
  • end_for
  • end_head
  • end_head1
  • end_head2
  • end_head3
  • end_head4
  • end_item
  • end_item_bullet
  • end_item_number
  • end_item_text
  • handle_pod_and_cut
  • handle_text
  • handle_whiteline
  • hyperlink
  • scream
  • start_B
  • start_C
  • start_Data
  • start_F
  • start_I
  • start_L
  • start_Para
  • start_S
  • start_Verbatim
  • start_X
  • start_fcode
  • start_for
  • start_head
  • start_head1
  • start_head2
  • start_head3
  • start_head4
  • start_item_bullet
  • start_item_number
  • start_item_text
  • start_over
  • start_over_block
  • start_over_bullet
  • start_over_empty
  • start_over_number
  • start_over_text
  • whine

🌸 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. These options are recognized, bestie:

  • -warnings => num β€” prints warnings if num is true. The higher the value of num, the more warnings get printed. RN there are only levels 1 and 2. Two. That's the whole vibe. πŸ’…
  • -quiet => num β€” if num is true, do not print any errors/warnings. This is the move when Pod::Checker is used to munge POD code into plain text from within POD formatters. Shhh. 🀫

πŸ¦‹ $checker->poderror( @args )

πŸ¦‹ $checker->poderror( {%opts}, @args )

Internal method for printing errors and warnings. If no options are given, it simply prints "@_". These 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'.

⭐ $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 NAME section.

⭐ $checker->node()

Add (if argument specified) and retrieve the nodes (as defined by =headX and =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 by X<>) of the current POD. They consist of plain text, each piece of whitespace is collapsed to a single blank.

Retrieve an array containing the hyperlinks to things outside the current POD (as defined by L<>). πŸ‘€

Each one is an instance of a class with the following 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. Do it. The maintainers want to hear from you. πŸ™ˆ

Brad Appleton <bradapp@enteract.com> (initial version), Marek Rouchal <marekr@cpan.org>, Marc Green <marcgreen@cpan.org> (port to Pod::Simple), Ricardo Signes <rjbs@cpan.org> (more porting to Pod::Simple), Karl Williamson <khw@cpan.org> (more porting to Pod::Simple). Iconic lineup honestly. 🌈

Based on code for Pod::Text::pod2text() written by Tom Christiansen <tchrist@mox.perl.com>.


✨ and that's the whole page, bestie ✨ this one's from perl v5.44.0, dated 2026-10-17, and it lives at Pod::Checker(3perl) β€” go forth and check that POD, you absolute main character πŸŽ€πŸ’œ

πŸ“¦ where this page comes from
  • arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms