home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>podchecker - check pod documents for syntax errors</TITLE>
- <LINK REL="stylesheet" HREF="../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> podchecker - check pod documents for syntax errors</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#options/arguments">OPTIONS/ARGUMENTS</A></LI>
- <UL>
-
- <LI><A HREF="#podchecker()"><CODE>podchecker()</CODE></A></LI>
- </UL>
-
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <LI><A HREF="#diagnostics">DIAGNOSTICS</A></LI>
- <UL>
-
- <LI><A HREF="#errors">Errors</A></LI>
- <LI><A HREF="#warnings">Warnings</A></LI>
- </UL>
-
- <LI><A HREF="#return value">RETURN VALUE</A></LI>
- <LI><A HREF="#examples">EXAMPLES</A></LI>
- <LI><A HREF="#interface">INTERFACE</A></LI>
- <LI><A HREF="#author">AUTHOR</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <P>Pod::Checker, <CODE>podchecker()</CODE> - check pod documents for syntax errors</P>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Linux</LI>
- <LI>Solaris</LI>
- <LI>Windows</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <PRE>
- use Pod::Checker;</PRE>
- <PRE>
- $syntax_okay = podchecker($filepath, $outputpath, %options);</PRE>
- <PRE>
- my $checker = new Pod::Checker %options;
- $checker->parse_from_file($filepath, \*STDERR);</PRE>
- <P>
- <HR>
- <H1><A NAME="options/arguments">OPTIONS/ARGUMENTS</A></H1>
- <P><CODE>$filepath</CODE> is the input POD to read and <CODE>$outputpath</CODE> 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 <CODE>\*STDIN</CODE>, and
- the output-file defaults to <CODE>\*STDERR</CODE>.</P>
- <P>
- <H2><A NAME="podchecker()"><CODE>podchecker()</CODE></A></H2>
- <P>This function can take a hash of options:</P>
- <DL>
- <DT><STRONG><A NAME="item_%2Dwarnings_%3D%3E_val"><STRONG>-warnings</STRONG> => <EM>val</EM></A></STRONG><BR>
- <DD>
- Turn warnings on/off. See <A HREF="#warnings">Warnings</A>.
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P><STRONG>podchecker</STRONG> will perform syntax checking of Perl5 POD format documentation.</P>
- <P><EM>NOTE THAT THIS MODULE IS CURRENTLY IN THE BETA STAGE!</EM></P>
- <P>It is hoped that curious/ambitious user will help flesh out and add the
- additional features they wish to see in <STRONG>Pod::Checker</STRONG> and <STRONG>podchecker</STRONG>
- and verify that the checks are consistent with <A HREF="../../lib/Pod/perlpod.html">the perlpod manpage</A>.</P>
- <P>The following checks are currently preformed:</P>
- <UL>
- <LI>
- Unknown '=xxxx' commands, unknown 'X<...>' interior-sequences,
- and unterminated interior sequences.
- <P></P>
- <LI>
- Check for proper balancing of <CODE>=begin</CODE> and <CODE>=end</CODE>. The contents of such
- a block are generally ignored, i.e. no syntax checks are performed.
- <P></P>
- <LI>
- Check for proper nesting and balancing of <CODE>=over</CODE>, <CODE>=item</CODE> and <CODE>=back</CODE>.
- <P></P>
- <LI>
- Check for same nested interior-sequences (e.g.
- <CODE>L<...L<...>...></CODE>).
- <P></P>
- <LI>
- Check for malformed or nonexisting entities <CODE>E<...></CODE>.
- <P></P>
- <LI>
- Check for correct syntax of hyperlinks <CODE>L<...></CODE>. See <A HREF="../../lib/Pod/perlpod.html">the perlpod manpage</A>
- for details.
- <P></P>
- <LI>
- 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.
- <P></P></UL>
- <P>
- <HR>
- <H1><A NAME="diagnostics">DIAGNOSTICS</A></H1>
- <P>
- <H2><A NAME="errors">Errors</A></H2>
- <UL>
- <LI><STRONG><A NAME="item_empty_%3Dheadn">empty =headn</A></STRONG><BR>
-
- A heading (<CODE>=head1</CODE> or <CODE>=head2</CODE>) without any text? That ain't no
- heading!
- <P></P>
- <LI><STRONG><A NAME="item_%3Dover_on_line_N_without_closing_%3Dback">=over on line <EM>N</EM> without closing =back</A></STRONG><BR>
-
- The <CODE>=over</CODE> command does not have a corresponding <CODE>=back</CODE> before the
- next heading (<CODE>=head1</CODE> or <CODE>=head2</CODE>) or the end of the file.
- <P></P>
- <LI><STRONG><A NAME="item_%3Ditem_without_previous_%3Dover">=item without previous =over</A></STRONG><BR>
-
- <LI><STRONG><A NAME="item_%3Dback_without_previous_%3Dover">=back without previous =over</A></STRONG><BR>
-
- An <CODE>=item</CODE> or <CODE>=back</CODE> command has been found outside a
- <CODE>=over</CODE>/<CODE>=back</CODE> block.
- <P></P>
- <LI><STRONG><A NAME="item_No_argument_for_%3Dbegin">No argument for =begin</A></STRONG><BR>
-
- A <CODE>=begin</CODE> command was found that is not followed by the formatter
- specification.
- <P></P>
- <LI><STRONG><A NAME="item_%3Dend_without_%3Dbegin">=end without =begin</A></STRONG><BR>
-
- A standalone <CODE>=end</CODE> command was found.
- <P></P>
- <LI><STRONG><A NAME="item_Nested_%3Dbegin%27s">Nested =begin's</A></STRONG><BR>
-
- There were at least two consecutive <CODE>=begin</CODE> commands without
- the corresponding <CODE>=end</CODE>. Only one <CODE>=begin</CODE> may be active at
- a time.
- <P></P>
- <LI><STRONG><A NAME="item_%3Dfor_without_formatter_specification">=for without formatter specification</A></STRONG><BR>
-
- There is no specification of the formatter after the <CODE>=for</CODE> command.
- <P></P>
- <LI><STRONG><A NAME="item_unresolved_internal_link_NAME">unresolved internal link <EM>NAME</EM></A></STRONG><BR>
-
- The given link to <EM>NAME</EM> does not have a matching node in the current
- POD. This also happend when a single word node name is not enclosed in
- <CODE>""</CODE>.
- <P></P>
- <LI><STRONG><A NAME="item_Unknown_command_%22CMD%22">Unknown command ``<EM>CMD</EM>''</A></STRONG><BR>
-
- An invalid POD command has been found. Valid are <CODE>=head1</CODE>, <CODE>=head2</CODE>,
- <CODE>=over</CODE>, <CODE>=item</CODE>, <CODE>=back</CODE>, <CODE>=begin</CODE>, <CODE>=end</CODE>, <CODE>=for</CODE>, <CODE>=pod</CODE>,
- <CODE>=cut</CODE>
- <P></P>
- <LI><STRONG><A NAME="item_Unknown_interior%2Dsequence_%22SEQ%22">Unknown interior-sequence ``<EM>SEQ</EM>''</A></STRONG><BR>
-
- An invalid markup command has been encountered. Valid are:
- <CODE>B<></CODE>, <CODE>C<></CODE>, <CODE>E<></CODE>, <CODE>F<></CODE>,
- <CODE>I<></CODE>, <CODE>L<></CODE>, <CODE>S<></CODE>, <CODE>X<></CODE>,
- <CODE>Z<></CODE>
- <P></P>
- <LI><STRONG><A NAME="item_nested_commands_CMD%3C%2E%2E%2ECMD%3C%2E%2E%2E%3E%">nested commands <EM>CMD</EM><...<EM>CMD</EM><...>...></A></STRONG><BR>
-
- Two nested identical markup commands have been found. Generally this
- does not make sense.
- <P></P>
- <LI><STRONG><A NAME="item_garbled_entity_STRING">garbled entity <EM>STRING</EM></A></STRONG><BR>
-
- The <EM>STRING</EM> found cannot be interpreted as a character entity.
- <P></P>
- <LI><STRONG><A NAME="item_Entity_number_out_of_range">Entity number out of range</A></STRONG><BR>
-
- An entity specified by number (dec, hex, oct) is out of range (1-255).
- <P></P>
- <LI><STRONG><A NAME="item_malformed_link_L%3C%3E">malformed link L<></A></STRONG><BR>
-
- The link found cannot be parsed because it does not conform to the
- syntax described in <A HREF="../../lib/Pod/perlpod.html">the perlpod manpage</A>.
- <P></P>
- <LI><STRONG><A NAME="item_nonempty_Z%3C%3E">nonempty Z<></A></STRONG><BR>
-
- The <CODE>Z<></CODE> sequence is supposed to be empty.
- <P></P>
- <LI><STRONG><A NAME="item_empty_X%3C%3E">empty X<></A></STRONG><BR>
-
- The index entry specified contains nothing but whitespace.
- <P></P>
- <LI><STRONG><A NAME="item_Spurious_text_after_%3Dpod_%2F_%3Dcut">Spurious text after =pod / =cut</A></STRONG><BR>
-
- The commands <CODE>=pod</CODE> and <CODE>=cut</CODE> do not take any arguments.
- <P></P>
- <LI><STRONG><A NAME="item_character">Spurious <CODE>character(s)</CODE> after =back</A></STRONG><BR>
-
- The <CODE>=back</CODE> command does not take any arguments.
- <P></P></UL>
- <P>
- <H2><A NAME="warnings">Warnings</A></H2>
- <P>These may not necessarily cause trouble, but indicate mediocre style.</P>
- <UL>
- <LI><STRONG><A NAME="item_multiple_occurence_of_link_target_name">multiple occurence of link target <EM>name</EM></A></STRONG><BR>
-
- The POD file has some <CODE>=item</CODE> and/or <CODE>=head</CODE> commands that have
- the same text. Potential hyperlinks to such a text cannot be unique then.
- <P></P>
- <LI><STRONG><A NAME="item_line_containing_nothing_but_whitespace_in_paragrap">line containing nothing but whitespace in paragraph</A></STRONG><BR>
-
- There is some whitespace on a seemingly empty line. POD is very sensitive
- to such things, so this is flagged. <STRONG>vi</STRONG> users switch on the <STRONG>list</STRONG>
- option to avoid this problem.
- <P></P>
- <LI><STRONG><A NAME="item_file_does_not_start_with_%3Dhead">file does not start with =head</A></STRONG><BR>
-
- The file starts with a different POD directive than head.
- This is most probably something you do not want.
- <P></P>
- <LI><STRONG><A NAME="item_No_numeric_argument_for_%3Dover">No numeric argument for =over</A></STRONG><BR>
-
- The <CODE>=over</CODE> command is supposed to have a numeric argument (the
- indentation).
- <P></P>
- <LI><STRONG><A NAME="item_previous_%3Ditem_has_no_contents">previous =item has no contents</A></STRONG><BR>
-
- There is a list <CODE>=item</CODE> right above the flagged line that has no
- text contents. You probably want to delete empty items.
- <P></P>
- <LI><STRONG><A NAME="item_paragraph">preceding non-item <CODE>paragraph(s)</CODE></A></STRONG><BR>
-
- A list introduced by <CODE>=over</CODE> starts with a text or verbatim paragraph,
- but continues with <CODE>=item</CODE>s. Move the non-item paragraph out of the
- <CODE>=over</CODE>/<CODE>=back</CODE> block.
- <P></P>
- <LI><STRONG><A NAME="item_mismatch">=item type mismatch (<EM>one</EM> vs. <EM>two</EM>)</A></STRONG><BR>
-
- A list started with e.g. a bulletted <CODE>=item</CODE> and continued with a
- numbered one. This is obviously inconsistent. For most translators the
- type of the <EM>first</EM> <CODE>=item</CODE> determines the type of the list.
- <P></P>
- <LI><STRONG><A NAME="item_N_unescaped_%3C%3E_in_paragraph"><EM>N</EM> unescaped <CODE><></CODE> in paragraph</A></STRONG><BR>
-
- Angle brackets not written as <CODE><lt></CODE> and <CODE><gt></CODE>
- can potentially cause errors as they could be misinterpreted as
- markup commands.
- <P></P>
- <LI><STRONG><A NAME="item_Unknown_entity">Unknown entity</A></STRONG><BR>
-
- A character entity was found that does not belong to the standard
- ISO set or the POD specials <CODE>verbar</CODE> and <CODE>sol</CODE>.
- <P></P>
- <LI><STRONG><A NAME="item_No_items_in_%3Dover">No items in =over</A></STRONG><BR>
-
- The list opened with <CODE>=over</CODE> does not contain any items.
- <P></P>
- <LI><STRONG><A NAME="item_No_argument_for_%3Ditem">No argument for =item</A></STRONG><BR>
-
- <CODE>=item</CODE> without any parameters is deprecated. It should either be followed
- by <CODE>*</CODE> 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.
- <P></P>
- <LI><STRONG><A NAME="item_empty_section_in_previous_paragraph">empty section in previous paragraph</A></STRONG><BR>
-
- The previous section (introduced by a <CODE>=head</CODE> command) does not contain
- any text. This usually indicates that something is missing. Note: A
- <CODE>=head1</CODE> followed immediately by <CODE>=head2</CODE> does not trigger this warning.
- <P></P>
- <LI><STRONG><A NAME="item_Verbatim_paragraph_in_NAME_section">Verbatim paragraph in NAME section</A></STRONG><BR>
-
- The NAME section (<CODE>=head1 NAME</CODE>) 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.
- <P></P>
- <LI><STRONG><A NAME="item_Hyperlinks">Hyperlinks</A></STRONG><BR>
-
- There are some warnings wrt. hyperlinks:
- Leading/trailing whitespace, newlines in hyperlinks,
- brackets <CODE>()</CODE>.
- <P></P></UL>
- <P>
- <HR>
- <H1><A NAME="return value">RETURN VALUE</A></H1>
- <P><STRONG>podchecker</STRONG> returns the number of POD syntax errors found or -1 if
- there were no POD commands at all found in the file.</P>
- <P>
- <HR>
- <H1><A NAME="examples">EXAMPLES</A></H1>
- <P><EM>[T.B.D.]</EM></P>
- <P>
- <HR>
- <H1><A NAME="interface">INTERFACE</A></H1>
- <P>While checking, this module collects document properties, e.g. the nodes
- for hyperlinks (<CODE>=headX</CODE>, <CODE>=item</CODE>) and index entries (<CODE>X<></CODE>).
- 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.</P>
- <DL>
- <DT><STRONG><A NAME="item_poderror"><CODE>$checker->poderror( @args )</CODE></A></STRONG><BR>
- <DD>
- <DT><STRONG><CODE>$checker->poderror( {%opts}, @args )</CODE></STRONG><BR>
- <DD>
- 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:
- <PRE>
- -msg</PRE>
- <P>A message to print prior to <CODE>@args</CODE>.</P>
- <PRE>
- -line</PRE>
- <P>The line number the error occurred in.</P>
- <PRE>
- -file</PRE>
- <P>The file (name) the error occurred in.</P>
- <PRE>
- -severity</PRE>
- <P>The error level, should be 'WARNING' or 'ERROR'.</P>
- <P></P>
- <DT><STRONG><A NAME="item_num_errors"><CODE>$checker->num_errors()</CODE></A></STRONG><BR>
- <DD>
- Set (if argument specified) and retrieve the number of errors found.
- <P></P>
- <DT><STRONG><A NAME="item_name"><CODE>$checker->name()</CODE></A></STRONG><BR>
- <DD>
- Set (if argument specified) and retrieve the canonical name of POD as
- found in the <CODE>=head1 NAME</CODE> section.
- <P></P>
- <DT><STRONG><A NAME="item_node"><CODE>$checker->node()</CODE></A></STRONG><BR>
- <DD>
- Add (if argument specified) and retrieve the nodes (as defined by <CODE>=headX</CODE>
- and <CODE>=item</CODE>) 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.
- <P></P>
- <DT><STRONG><A NAME="item_idx"><CODE>$checker->idx()</CODE></A></STRONG><BR>
- <DD>
- Add (if argument specified) and retrieve the index entries (as defined by
- <CODE>X<></CODE>) of the current POD. They consist of plain text, each piece
- of whitespace is collapsed to a single blank.
- <P></P>
- <DT><STRONG><A NAME="item_hyperlink"><CODE>$checker->hyperlink()</CODE></A></STRONG><BR>
- <DD>
- Add (if argument specified) and retrieve the hyperlinks (as defined by
- <CODE>L<></CODE>) of the current POD. They consist of an 2-item array: line
- number and <CODE>Pod::Hyperlink</CODE> object.
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="author">AUTHOR</A></H1>
- <P>Brad Appleton <<A HREF="mailto:bradapp@enteract.com">bradapp@enteract.com</A>> (initial version),
- Marek Rouchal <<A HREF="mailto:marek@saftsack.fs.uni-bayreuth.de">marek@saftsack.fs.uni-bayreuth.de</A>></P>
- <P>Based on code for <STRONG>Pod::Text::pod2text()</STRONG> written by
- Tom Christiansen <<A HREF="mailto:tchrist@mox.perl.com">tchrist@mox.perl.com</A>></P>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> podchecker - check pod documents for syntax errors</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-