home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd1.bin / zkuste / Perl / ActivePerl-5.6.0.613.msi / 䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥 / _310fc07d5dbfe94eafe434485274ab2e < prev    next >
Text File  |  2000-03-23  |  16KB  |  378 lines

  1.  
  2. <HTML>
  3. <HEAD>
  4. <TITLE>podchecker - check pod documents for syntax errors</TITLE>
  5. <LINK REL="stylesheet" HREF="../../Active.css" TYPE="text/css">
  6. <LINK REV="made" HREF="mailto:">
  7. </HEAD>
  8.  
  9. <BODY>
  10. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  11. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  12. <STRONG><P CLASS=block> podchecker - check pod documents for syntax errors</P></STRONG>
  13. </TD></TR>
  14. </TABLE>
  15.  
  16. <A NAME="__index__"></A>
  17. <!-- INDEX BEGIN -->
  18.  
  19. <UL>
  20.  
  21.     <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
  22.  
  23.     <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
  24.     <LI><A HREF="#options/arguments">OPTIONS/ARGUMENTS</A></LI>
  25.     <UL>
  26.  
  27.         <LI><A HREF="#podchecker()"><CODE>podchecker()</CODE></A></LI>
  28.     </UL>
  29.  
  30.     <LI><A HREF="#description">DESCRIPTION</A></LI>
  31.     <LI><A HREF="#diagnostics">DIAGNOSTICS</A></LI>
  32.     <UL>
  33.  
  34.         <LI><A HREF="#errors">Errors</A></LI>
  35.         <LI><A HREF="#warnings">Warnings</A></LI>
  36.     </UL>
  37.  
  38.     <LI><A HREF="#return value">RETURN VALUE</A></LI>
  39.     <LI><A HREF="#examples">EXAMPLES</A></LI>
  40.     <LI><A HREF="#interface">INTERFACE</A></LI>
  41.     <LI><A HREF="#author">AUTHOR</A></LI>
  42. </UL>
  43. <!-- INDEX END -->
  44.  
  45. <HR>
  46. <P>
  47. <H1><A NAME="name">NAME</A></H1>
  48. <P>Pod::Checker, <CODE>podchecker()</CODE> - check pod documents for syntax errors</P>
  49. <P>
  50. <HR>
  51. <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
  52. <UL>
  53. <LI>Linux</LI>
  54. <LI>Solaris</LI>
  55. <LI>Windows</LI>
  56. </UL>
  57. <HR>
  58. <H1><A NAME="synopsis">SYNOPSIS</A></H1>
  59. <PRE>
  60.   use Pod::Checker;</PRE>
  61. <PRE>
  62.   $syntax_okay = podchecker($filepath, $outputpath, %options);</PRE>
  63. <PRE>
  64.   my $checker = new Pod::Checker %options;
  65.   $checker->parse_from_file($filepath, \*STDERR);</PRE>
  66. <P>
  67. <HR>
  68. <H1><A NAME="options/arguments">OPTIONS/ARGUMENTS</A></H1>
  69. <P><CODE>$filepath</CODE> is the input POD to read and <CODE>$outputpath</CODE> is
  70. where to write POD syntax error messages. Either argument may be a scalar
  71. indicating a file-path, or else a reference to an open filehandle.
  72. If unspecified, the input-file it defaults to <CODE>\*STDIN</CODE>, and
  73. the output-file defaults to <CODE>\*STDERR</CODE>.</P>
  74. <P>
  75. <H2><A NAME="podchecker()"><CODE>podchecker()</CODE></A></H2>
  76. <P>This function can take a hash of options:</P>
  77. <DL>
  78. <DT><STRONG><A NAME="item_%2Dwarnings_%3D%3E_val"><STRONG>-warnings</STRONG> => <EM>val</EM></A></STRONG><BR>
  79. <DD>
  80. Turn warnings on/off. See <A HREF="#warnings">Warnings</A>.
  81. <P></P></DL>
  82. <P>
  83. <HR>
  84. <H1><A NAME="description">DESCRIPTION</A></H1>
  85. <P><STRONG>podchecker</STRONG> will perform syntax checking of Perl5 POD format documentation.</P>
  86. <P><EM>NOTE THAT THIS MODULE IS CURRENTLY IN THE BETA STAGE!</EM></P>
  87. <P>It is hoped that curious/ambitious user will help flesh out and add the
  88. additional features they wish to see in <STRONG>Pod::Checker</STRONG> and <STRONG>podchecker</STRONG>
  89. and verify that the checks are consistent with <A HREF="../../lib/Pod/perlpod.html">the perlpod manpage</A>.</P>
  90. <P>The following checks are currently preformed:</P>
  91. <UL>
  92. <LI>
  93. Unknown '=xxxx' commands, unknown 'X<...>' interior-sequences,
  94. and unterminated interior sequences.
  95. <P></P>
  96. <LI>
  97. Check for proper balancing of <CODE>=begin</CODE> and <CODE>=end</CODE>. The contents of such
  98. a block are generally ignored, i.e. no syntax checks are performed.
  99. <P></P>
  100. <LI>
  101. Check for proper nesting and balancing of <CODE>=over</CODE>, <CODE>=item</CODE> and <CODE>=back</CODE>.
  102. <P></P>
  103. <LI>
  104. Check for same nested interior-sequences (e.g. 
  105. <CODE>L<...L<...>...></CODE>).
  106. <P></P>
  107. <LI>
  108. Check for malformed or nonexisting entities <CODE>E<...></CODE>.
  109. <P></P>
  110. <LI>
  111. Check for correct syntax of hyperlinks <CODE>L<...></CODE>. See <A HREF="../../lib/Pod/perlpod.html">the perlpod manpage</A>
  112. for details.
  113. <P></P>
  114. <LI>
  115. Check for unresolved document-internal links. This check may also reveal
  116. misspelled links that seem to be internal links but should be links
  117. to something else.
  118. <P></P></UL>
  119. <P>
  120. <HR>
  121. <H1><A NAME="diagnostics">DIAGNOSTICS</A></H1>
  122. <P>
  123. <H2><A NAME="errors">Errors</A></H2>
  124. <UL>
  125. <LI><STRONG><A NAME="item_empty_%3Dheadn">empty =headn</A></STRONG><BR>
  126.  
  127. A heading (<CODE>=head1</CODE> or <CODE>=head2</CODE>) without any text? That ain't no
  128. heading!
  129. <P></P>
  130. <LI><STRONG><A NAME="item_%3Dover_on_line_N_without_closing_%3Dback">=over on line <EM>N</EM> without closing =back</A></STRONG><BR>
  131.  
  132. The <CODE>=over</CODE> command does not have a corresponding <CODE>=back</CODE> before the
  133. next heading (<CODE>=head1</CODE> or <CODE>=head2</CODE>) or the end of the file.
  134. <P></P>
  135. <LI><STRONG><A NAME="item_%3Ditem_without_previous_%3Dover">=item without previous =over</A></STRONG><BR>
  136.  
  137. <LI><STRONG><A NAME="item_%3Dback_without_previous_%3Dover">=back without previous =over</A></STRONG><BR>
  138.  
  139. An <CODE>=item</CODE> or <CODE>=back</CODE> command has been found outside a
  140. <CODE>=over</CODE>/<CODE>=back</CODE> block.
  141. <P></P>
  142. <LI><STRONG><A NAME="item_No_argument_for_%3Dbegin">No argument for =begin</A></STRONG><BR>
  143.  
  144. A <CODE>=begin</CODE> command was found that is not followed by the formatter
  145. specification.
  146. <P></P>
  147. <LI><STRONG><A NAME="item_%3Dend_without_%3Dbegin">=end without =begin</A></STRONG><BR>
  148.  
  149. A standalone <CODE>=end</CODE> command was found.
  150. <P></P>
  151. <LI><STRONG><A NAME="item_Nested_%3Dbegin%27s">Nested =begin's</A></STRONG><BR>
  152.  
  153. There were at least two consecutive <CODE>=begin</CODE> commands without
  154. the corresponding <CODE>=end</CODE>. Only one <CODE>=begin</CODE> may be active at
  155. a time.
  156. <P></P>
  157. <LI><STRONG><A NAME="item_%3Dfor_without_formatter_specification">=for without formatter specification</A></STRONG><BR>
  158.  
  159. There is no specification of the formatter after the <CODE>=for</CODE> command.
  160. <P></P>
  161. <LI><STRONG><A NAME="item_unresolved_internal_link_NAME">unresolved internal link <EM>NAME</EM></A></STRONG><BR>
  162.  
  163. The given link to <EM>NAME</EM> does not have a matching node in the current
  164. POD. This also happend when a single word node name is not enclosed in
  165. <CODE>""</CODE>.
  166. <P></P>
  167. <LI><STRONG><A NAME="item_Unknown_command_%22CMD%22">Unknown command ``<EM>CMD</EM>''</A></STRONG><BR>
  168.  
  169. An invalid POD command has been found. Valid are <CODE>=head1</CODE>, <CODE>=head2</CODE>,
  170. <CODE>=over</CODE>, <CODE>=item</CODE>, <CODE>=back</CODE>, <CODE>=begin</CODE>, <CODE>=end</CODE>, <CODE>=for</CODE>, <CODE>=pod</CODE>,
  171. <CODE>=cut</CODE>
  172. <P></P>
  173. <LI><STRONG><A NAME="item_Unknown_interior%2Dsequence_%22SEQ%22">Unknown interior-sequence ``<EM>SEQ</EM>''</A></STRONG><BR>
  174.  
  175. An invalid markup command has been encountered. Valid are:
  176. <CODE>B<></CODE>, <CODE>C<></CODE>, <CODE>E<></CODE>, <CODE>F<></CODE>, 
  177. <CODE>I<></CODE>, <CODE>L<></CODE>, <CODE>S<></CODE>, <CODE>X<></CODE>, 
  178. <CODE>Z<></CODE>
  179. <P></P>
  180. <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>
  181.  
  182. Two nested identical markup commands have been found. Generally this
  183. does not make sense.
  184. <P></P>
  185. <LI><STRONG><A NAME="item_garbled_entity_STRING">garbled entity <EM>STRING</EM></A></STRONG><BR>
  186.  
  187. The <EM>STRING</EM> found cannot be interpreted as a character entity.
  188. <P></P>
  189. <LI><STRONG><A NAME="item_Entity_number_out_of_range">Entity number out of range</A></STRONG><BR>
  190.  
  191. An entity specified by number (dec, hex, oct) is out of range (1-255).
  192. <P></P>
  193. <LI><STRONG><A NAME="item_malformed_link_L%3C%3E">malformed link L<></A></STRONG><BR>
  194.  
  195. The link found cannot be parsed because it does not conform to the
  196. syntax described in <A HREF="../../lib/Pod/perlpod.html">the perlpod manpage</A>.
  197. <P></P>
  198. <LI><STRONG><A NAME="item_nonempty_Z%3C%3E">nonempty Z<></A></STRONG><BR>
  199.  
  200. The <CODE>Z<></CODE> sequence is supposed to be empty.
  201. <P></P>
  202. <LI><STRONG><A NAME="item_empty_X%3C%3E">empty X<></A></STRONG><BR>
  203.  
  204. The index entry specified contains nothing but whitespace.
  205. <P></P>
  206. <LI><STRONG><A NAME="item_Spurious_text_after_%3Dpod_%2F_%3Dcut">Spurious text after =pod / =cut</A></STRONG><BR>
  207.  
  208. The commands <CODE>=pod</CODE> and <CODE>=cut</CODE> do not take any arguments.
  209. <P></P>
  210. <LI><STRONG><A NAME="item_character">Spurious <CODE>character(s)</CODE> after =back</A></STRONG><BR>
  211.  
  212. The <CODE>=back</CODE> command does not take any arguments.
  213. <P></P></UL>
  214. <P>
  215. <H2><A NAME="warnings">Warnings</A></H2>
  216. <P>These may not necessarily cause trouble, but indicate mediocre style.</P>
  217. <UL>
  218. <LI><STRONG><A NAME="item_multiple_occurence_of_link_target_name">multiple occurence of link target <EM>name</EM></A></STRONG><BR>
  219.  
  220. The POD file has some <CODE>=item</CODE> and/or <CODE>=head</CODE> commands that have
  221. the same text. Potential hyperlinks to such a text cannot be unique then.
  222. <P></P>
  223. <LI><STRONG><A NAME="item_line_containing_nothing_but_whitespace_in_paragrap">line containing nothing but whitespace in paragraph</A></STRONG><BR>
  224.  
  225. There is some whitespace on a seemingly empty line. POD is very sensitive
  226. to such things, so this is flagged. <STRONG>vi</STRONG> users switch on the <STRONG>list</STRONG>
  227. option to avoid this problem.
  228. <P></P>
  229. <LI><STRONG><A NAME="item_file_does_not_start_with_%3Dhead">file does not start with =head</A></STRONG><BR>
  230.  
  231. The file starts with a different POD directive than head.
  232. This is most probably something you do not want.
  233. <P></P>
  234. <LI><STRONG><A NAME="item_No_numeric_argument_for_%3Dover">No numeric argument for =over</A></STRONG><BR>
  235.  
  236. The <CODE>=over</CODE> command is supposed to have a numeric argument (the
  237. indentation).
  238. <P></P>
  239. <LI><STRONG><A NAME="item_previous_%3Ditem_has_no_contents">previous =item has no contents</A></STRONG><BR>
  240.  
  241. There is a list <CODE>=item</CODE> right above the flagged line that has no
  242. text contents. You probably want to delete empty items.
  243. <P></P>
  244. <LI><STRONG><A NAME="item_paragraph">preceding non-item <CODE>paragraph(s)</CODE></A></STRONG><BR>
  245.  
  246. A list introduced by <CODE>=over</CODE> starts with a text or verbatim paragraph,
  247. but continues with <CODE>=item</CODE>s. Move the non-item paragraph out of the
  248. <CODE>=over</CODE>/<CODE>=back</CODE> block.
  249. <P></P>
  250. <LI><STRONG><A NAME="item_mismatch">=item type mismatch (<EM>one</EM> vs. <EM>two</EM>)</A></STRONG><BR>
  251.  
  252. A list started with e.g. a bulletted <CODE>=item</CODE> and continued with a
  253. numbered one. This is obviously inconsistent. For most translators the
  254. type of the <EM>first</EM> <CODE>=item</CODE> determines the type of the list.
  255. <P></P>
  256. <LI><STRONG><A NAME="item_N_unescaped_%3C%3E_in_paragraph"><EM>N</EM> unescaped <CODE><></CODE> in paragraph</A></STRONG><BR>
  257.  
  258. Angle brackets not written as <CODE><lt></CODE> and <CODE><gt></CODE>
  259. can potentially cause errors as they could be misinterpreted as
  260. markup commands.
  261. <P></P>
  262. <LI><STRONG><A NAME="item_Unknown_entity">Unknown entity</A></STRONG><BR>
  263.  
  264. A character entity was found that does not belong to the standard
  265. ISO set or the POD specials <CODE>verbar</CODE> and <CODE>sol</CODE>.
  266. <P></P>
  267. <LI><STRONG><A NAME="item_No_items_in_%3Dover">No items in =over</A></STRONG><BR>
  268.  
  269. The list opened with <CODE>=over</CODE> does not contain any items.
  270. <P></P>
  271. <LI><STRONG><A NAME="item_No_argument_for_%3Ditem">No argument for =item</A></STRONG><BR>
  272.  
  273. <CODE>=item</CODE> without any parameters is deprecated. It should either be followed
  274. by <CODE>*</CODE> to indicate an unordered list, by a number (optionally followed
  275. by a dot) to indicate an ordered (numbered) list or simple text for a
  276. definition list.
  277. <P></P>
  278. <LI><STRONG><A NAME="item_empty_section_in_previous_paragraph">empty section in previous paragraph</A></STRONG><BR>
  279.  
  280. The previous section (introduced by a <CODE>=head</CODE> command) does not contain
  281. any text. This usually indicates that something is missing. Note: A 
  282. <CODE>=head1</CODE> followed immediately by <CODE>=head2</CODE> does not trigger this warning.
  283. <P></P>
  284. <LI><STRONG><A NAME="item_Verbatim_paragraph_in_NAME_section">Verbatim paragraph in NAME section</A></STRONG><BR>
  285.  
  286. The NAME section (<CODE>=head1 NAME</CODE>) should consist of a single paragraph
  287. with the script/module name, followed by a dash `-' and a very short
  288. description of what the thing is good for.
  289. <P></P>
  290. <LI><STRONG><A NAME="item_Hyperlinks">Hyperlinks</A></STRONG><BR>
  291.  
  292. There are some warnings wrt. hyperlinks:
  293. Leading/trailing whitespace, newlines in hyperlinks,
  294. brackets <CODE>()</CODE>.
  295. <P></P></UL>
  296. <P>
  297. <HR>
  298. <H1><A NAME="return value">RETURN VALUE</A></H1>
  299. <P><STRONG>podchecker</STRONG> returns the number of POD syntax errors found or -1 if
  300. there were no POD commands at all found in the file.</P>
  301. <P>
  302. <HR>
  303. <H1><A NAME="examples">EXAMPLES</A></H1>
  304. <P><EM>[T.B.D.]</EM></P>
  305. <P>
  306. <HR>
  307. <H1><A NAME="interface">INTERFACE</A></H1>
  308. <P>While checking, this module collects document properties, e.g. the nodes
  309. for hyperlinks (<CODE>=headX</CODE>, <CODE>=item</CODE>) and index entries (<CODE>X<></CODE>).
  310. POD translators can use this feature to syntax-check and get the nodes in
  311. a first pass before actually starting to convert. This is expensive in terms
  312. of execution time, but allows for very robust conversions.</P>
  313. <DL>
  314. <DT><STRONG><A NAME="item_poderror"><CODE>$checker->poderror( @args )</CODE></A></STRONG><BR>
  315. <DD>
  316. <DT><STRONG><CODE>$checker->poderror( {%opts}, @args )</CODE></STRONG><BR>
  317. <DD>
  318. Internal method for printing errors and warnings. If no options are
  319. given, simply prints ``@_''. The following options are recognized and used
  320. to form the output:
  321. <PRE>
  322.   -msg</PRE>
  323. <P>A message to print prior to <CODE>@args</CODE>.</P>
  324. <PRE>
  325.   -line</PRE>
  326. <P>The line number the error occurred in.</P>
  327. <PRE>
  328.   -file</PRE>
  329. <P>The file (name) the error occurred in.</P>
  330. <PRE>
  331.   -severity</PRE>
  332. <P>The error level, should be 'WARNING' or 'ERROR'.</P>
  333. <P></P>
  334. <DT><STRONG><A NAME="item_num_errors"><CODE>$checker->num_errors()</CODE></A></STRONG><BR>
  335. <DD>
  336. Set (if argument specified) and retrieve the number of errors found.
  337. <P></P>
  338. <DT><STRONG><A NAME="item_name"><CODE>$checker->name()</CODE></A></STRONG><BR>
  339. <DD>
  340. Set (if argument specified) and retrieve the canonical name of POD as
  341. found in the <CODE>=head1 NAME</CODE> section.
  342. <P></P>
  343. <DT><STRONG><A NAME="item_node"><CODE>$checker->node()</CODE></A></STRONG><BR>
  344. <DD>
  345. Add (if argument specified) and retrieve the nodes (as defined by <CODE>=headX</CODE>
  346. and <CODE>=item</CODE>) of the current POD. The nodes are returned in the order of
  347. their occurence. They consist of plain text, each piece of whitespace is
  348. collapsed to a single blank.
  349. <P></P>
  350. <DT><STRONG><A NAME="item_idx"><CODE>$checker->idx()</CODE></A></STRONG><BR>
  351. <DD>
  352. Add (if argument specified) and retrieve the index entries (as defined by
  353. <CODE>X<></CODE>) of the current POD. They consist of plain text, each piece
  354. of whitespace is collapsed to a single blank.
  355. <P></P>
  356. <DT><STRONG><A NAME="item_hyperlink"><CODE>$checker->hyperlink()</CODE></A></STRONG><BR>
  357. <DD>
  358. Add (if argument specified) and retrieve the hyperlinks (as defined by
  359. <CODE>L<></CODE>) of the current POD. They consist of an 2-item array: line
  360. number and <CODE>Pod::Hyperlink</CODE> object.
  361. <P></P></DL>
  362. <P>
  363. <HR>
  364. <H1><A NAME="author">AUTHOR</A></H1>
  365. <P>Brad Appleton <<A HREF="mailto:bradapp@enteract.com">bradapp@enteract.com</A>> (initial version),
  366. Marek Rouchal <<A HREF="mailto:marek@saftsack.fs.uni-bayreuth.de">marek@saftsack.fs.uni-bayreuth.de</A>></P>
  367. <P>Based on code for <STRONG>Pod::Text::pod2text()</STRONG> written by
  368. Tom Christiansen <<A HREF="mailto:tchrist@mox.perl.com">tchrist@mox.perl.com</A>></P>
  369. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  370. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  371. <STRONG><P CLASS=block> podchecker - check pod documents for syntax errors</P></STRONG>
  372. </TD></TR>
  373. </TABLE>
  374.  
  375. </BODY>
  376.  
  377. </HTML>
  378.