Perl Diver 2.31
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

Pod::Checker

Name Pod::Checker
Version 1.73
Located at /usr/share/perl5/vendor_perl
File /usr/share/perl5/vendor_perl/Pod/Checker.pm
Is Core No
Search CPAN for this module Pod::Checker
Documentation Pod::Checker
Module Details Pod::Checker

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 may be a scalar indicating a file-path, or else a reference to an open filehandle. If unspecified, the input-file it 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. val is usually 1 for on, but higher values trigger additional warnings. See Warnings.

-quiet => val
If val is true, do not print any errors/warnings.


DESCRIPTION

podchecker will perform syntax checking of Perl5 POD format documentation.

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

Warnings

These may not necessarily cause trouble, but indicate mediocre style.

Hyperlinks

There are some warnings with respect to malformed hyperlinks:

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

While checking, this module collects 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. This is expensive in terms of execution time, but 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 use Pod::Simple's interface when using Pod::Checker unless it is documented somewhere on this page. I repeat, DO NOT USE POD::SIMPLE'S INTERFACE.

Pod::Checker->new( %options )
Return 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 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 useful when Pod::Checker is used to munge POD code into plain text from within POD formatters.

$checker->poderror( @args )
$checker->poderror( {%opts}, @args )$checker->poderror( {%opts}, @args )
Internal method for printing errors and warnings. If no options are given, 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'.

$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.

$checker->hyperlinks()
Retrieve an array containing the hyperlinks to things outside the current POD (as defined by L<>).

Each 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()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 to Pod::Simple) Ricardo Signes <rjbs@cpan.org> (more porting to Pod::Simple) Karl Williamson <khw@cpan.org> (more porting to Pod::Simple)

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

Perl Diver brought to you by ScriptSolutions.com © 1997- 2024