|
podchecker - check pod documents for syntax errors |
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 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:
podchecker will perform syntax checking of Perl5 POD format documentation.
NOTE THAT THIS MODULE IS CURRENTLY IN THE BETA STAGE!
It is hoped that curious/ambitious user will help flesh out and add the additional features they wish to see in Pod::Checker and podchecker and verify that the checks are consistent with the perlpod manpage.
The following checks are currently preformed:
=begin and =end. The contents of such
a block are generally ignored, i.e. no syntax checks are performed.
=over, =item and =back.
L<...L<...>...>).
E<...>.
L<...>. See the perlpod manpage
for details.
=head1 or =head2) without any text? That ain't no
heading!
=over command does not have a corresponding =back before the
next heading (=head1 or =head2) or the end of the file.
=item or =back command has been found outside a
=over/=back block.
=begin command was found that is not followed by the formatter
specification.
=end command was found.
=begin commands without
the corresponding =end. Only one =begin may be active at
a time.
=for command.
"".
=head1, =head2,
=over, =item, =back, =begin, =end, =for, =pod,
=cut
B<>, C<>, E<>, F<>,
I<>, L<>, S<>, X<>,
Z<>
Z<> sequence is supposed to be empty.
=pod and =cut do not take any arguments.
character(s) after =back=back command does not take any arguments.
These may not necessarily cause trouble, but indicate mediocre style.
=item and/or =head commands that have
the same text. Potential hyperlinks to such a text cannot be unique then.
=over command is supposed to have a numeric argument (the
indentation).
=item right above the flagged line that has no
text contents. You probably want to delete empty items.
paragraph(s)=over starts with a text or verbatim paragraph,
but continues with =items. Move the non-item paragraph out of the
=over/=back block.
=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.
<> in paragraph<lt> and <gt>
can potentially cause errors as they could be misinterpreted as
markup commands.
verbar and sol.
=over does not contain any items.
=item without any parameters is deprecated. It should either be followed
by * to indicate an unordered list, by a number (optionally followed
by a dot) to indicate an ordered (numbered) list or simple text for a
definition list.
=head command) does not contain
any text. This usually indicates that something is missing. Note:
A
=head1 followed immediately by =head2 does not trigger this warning.
=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.
().
podchecker returns the number of POD syntax errors found or -1 if there were no POD commands at all found in the file.
[T.B.D.]
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.
$checker->poderror( @args )$checker->poderror( {%opts}, @args )-msg
A message to print prior to @args.
-line
The line number the error occurred in.
-file
The file (name) the error occurred in.
-severity
The error level, should be 'WARNING' or 'ERROR'.
$checker->num_errors()$checker->name()=head1 NAME section.
$checker->node()=headX
and =item) of the current
POD. The nodes are returned in the order of
their occurence. They consist of plain text, each piece of whitespace is
collapsed to a single blank.
$checker->idx()X<>) of the current
POD. They consist of plain text, each piece
of whitespace is collapsed to a single blank.
$checker->hyperlink()L<>) of the current
POD. They consist of an 2-item array: line
number and Pod::Hyperlink object.
Brad Appleton <bradapp@enteract.com> (initial version), Marek Rouchal <marek@saftsack.fs.uni-bayreuth.de>
Based on code for Pod::Text::pod2text() written by Tom Christiansen <tchrist@mox.perl.com>
|
podchecker - check pod documents for syntax errors |