MAN page from Other perl-PodParser-1.28-8.noarch.rpm


Section: User Contributed Perl Documentation (3)
Updated: perl v5.6.1


Pod::Checker, podchecker() - check pod documents for syntax errors 


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


"$filepath" is the input POD to read and "$outputpath" iswhere to write POD syntax error messages. Either argument may be a scalarindicating a file-path, or else a reference to an open filehandle.If unspecified, the input-file it defaults to "\*STDIN", andthe output-file defaults to "\*STDERR". 


This function can take a hash of options:
-warnings => val
Turn warnings on/off. val is usually 1 for on, but higher valuestrigger additional warnings. See the section on "Warnings".


podchecker will perform syntax checking of Perl5 POD format documentation.

Curious/ambitious users are welcome to propose additional features they wishto see in Pod::Checker and podchecker and verify that the checks areconsistent with the perlpod manpage.

The following checks are currently preformed:

Unknown '=xxxx' commands, unknown 'X<...>' interior-sequences,and unterminated interior sequences.
Check for proper balancing of "=begin" and "=end". The contents of sucha 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 nonexisting entities "E<...>".
Check for correct syntax of hyperlinks "L<...>". See the perlpod manpagefor details.
Check for unresolved document-internal links. This check may also revealmisspelled links that seem to be internal links but should be linksto something else.




* empty =headn
A heading ("=head1" or "=head2") without any text? That ain't noheading!
* =over on line N without closing =back
The "=over" command does not have a corresponding "=back" before thenext heading ("=head1" or "=head2") or the end of the file.
* =item without previous =over

* =back without previous =over
An "=item" or "=back" command has been found outside a"=over"/"=back" block.
* argument for =begin
A "=begin" command was found that is not followed by the formatterspecification.
* =end without =begin
A standalone "=end" command was found.
* Nested =begin's
There were at least two consecutive "=begin" commands withoutthe corresponding "=end". Only one "=begin" may be active ata time.
* =for without formatter specification
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 currentPOD. This also happend when a single word node name is not enclosed in"""".
* Unknown command CMD

* Unknown command ``CMD''
An invalid POD command has been found. Valid are "=head1", "=head2","=head3", "=head4", "=over", "=item", "=back", "=begin", "=end","=for", "=pod", "=cut"
* Unknown interior-sequence SEQ

* Unknown interior-sequence ``SEQ''
An invalid markup command has been encountered. Valid are:"B<>", "C<>", "E<>", "F<>", "I<>", "L<>", "S<>", "X<>", "Z<>"
* nested commands CMD<...CMD<...>...>
Two nested identical markup commands have been found. Generally thisdoes not make sense.
* garbled entity STRING
The STRING found cannot be interpreted as a character entity.
* Entity number out of range
An entity specified by number (dec, hex, oct) is out of range (1-255).
* malformed link L<>
The link found cannot be parsed because it does not conform to thesyntax described in the perlpod manpage.
* nonempty Z<>
The "Z<>" sequence is supposed to be empty.
* empty X<>
The index entry specified contains nothing but whitespace.
* Spurious text after =pod / =cut
The commands "=pod" and "=cut" do not take any arguments.
* Spurious character(s) after =back
The "=back" command does not take any arguments.


These may not necessarily cause trouble, but indicate mediocre style.
* multiple occurrence of link target name
The POD file has some "=item" and/or "=head" commands that havethe same text. Potential hyperlinks to such a text cannot be unique then.
* line containing nothing but whitespace in paragraph
There is some whitespace on a seemingly empty line. POD is very sensitiveto such things, so this is flagged. vi users switch on the listoption to avoid this problem.
* previous =item has no contents
There is a list "=item" right above the flagged line that has notext contents. You probably want to delete empty items.
* preceding non-item paragraph(s)
A list introduced by "=over" starts with a text or verbatim paragraph,but continues with "=item"s. Move the non-item paragraph out of the"=over"/"=back" block.
* =item type mismatch (one vs. two)
A list started with e.g. a bulletted "=item" and continued with anumbered one. This is obviously inconsistent. For most translators thetype of the first "=item" determines the type of the list.
* N unescaped <> in paragraph

* N unescaped <> in paragraph
Angle brackets not written as "<lt>" and "<gt>"can potentially cause errors as they could be misinterpreted asmarkup commands. This is only printed when the -warnings level isgreater than 1.
* Unknown entity
A character entity was found that does not belong to the standardISO set or the POD specials "verbar" and "sol".
* items in =over
The list opened with "=over" does not contain any items.
* argument for =item
"=item" without any parameters is deprecated. It should either be followedby "*" to indicate an unordered list, by a number (optionally followedby a dot) to indicate an ordered (numbered) list or simple text for adefinition list.
* empty section in previous paragraph
The previous section (introduced by a "=head" command) does not containany text. 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 paragraphwith the script/module name, followed by a dash `-' and a very shortdescription 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".


There are some warnings wrt. malformed hyperlinks.
* ignoring leading/trailing whitespace in link
There is whitespace at the beginning or the end of the contents of L<...>.
* (section) in '$page' deprecated
There is a section detected in the page name of L<...>, e.g."L<passwd(2)>". POD hyperlinks may point to POD documents only.Please write "C<passwd(2)>" instead. Some formatters are ableto expand this to appropriate code. For links to (builtin) functions,please say "L<perlfunc/mkdir>", without ().
* 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 ``/'' istext and which is a delimiter in case of doubt, one ought to escapethese literal characters like this:

  /     E<sol>  |     E<verbar>


podchecker returns the number of POD syntax errors found or -1 ifthere were no POD commands at all found in the file. 


See the SYNOPSIS entry elsewhere in this document 


While checking, this module collects document properties, e.g. the nodesfor hyperlinks ("=headX", "=item") and index entries ("X<>").POD translators can use this feature to syntax-check and get the nodes ina first pass before actually starting to convert. This is expensive in termsof execution time, but allows for very robust conversions.

Since PodParser-1.24 the Pod::Checker module uses only the poderrormethod to print errors and warnings. The summary output (e.g. ``Pod syntax OK'') has been dropped from the module and has been included inpodchecker (the script). This allows users of Pod::Checker tocontrol completely the output behaviour. Users of podchecker (the script)get the well-known behaviour.

Pod::Checker->new( %options )

Pod::Checker->new( %options )
Return a reference to a new Pod::Checker object that inherits fromPod::Parser and is used for calling the required methods later. Thefollowing options are recognized:

"-warnings => num"
  Print warnings if "num" is true. The higher the value of "num",the more warnings are printed. Currently there are only levels 1 and 2.

"-quiet => num"
  If "num" is true, do not print any errors/warnings. This is usefulwhen Pod::Checker is used to munge POD code into plain text from withinPOD formatters.

$checker->poderror( @args )

$checker->poderror( @args )

$checker->poderror( {%opts}, @args )

$checker->poderror( {%opts}, @args )
Internal method for printing errors and warnings. If no options aregiven, simply prints ``@_''. The following options are recognized and usedto form the output:

A message to print prior to "@args".

The line number the error occurred in.

The file (name) the error occurred in.

The error level, should be 'WARNING' or 'ERROR'.

Set (if argument specified) and retrieve the number of errors found.

Set (if argument specified) and retrieve the number of warnings found.

Set (if argument specified) and retrieve the canonical name of POD asfound in the "=head1 NAME" section.

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 oftheir occurrence. They consist of plain text, each piece of whitespace iscollapsed to a single blank.

Add (if argument specified) and retrieve the index entries (as defined by"X<>") of the current POD. They consist of plain text, each pieceof whitespace is collapsed to a single blank.

Add (if argument specified) and retrieve the hyperlinks (as defined by"L<>") of the current POD. They consist of a 2-item array: linenumber and "Pod::Hyperlink" object.


Please report bugs using

Brad Appleton <> (initial version),Marek Rouchal <>

Based on code for Pod::Text::pod2text() written byTom Christiansen <>




This document was created byman2html,using the manual pages.