xref: /openbsd-src/gnu/usr.bin/perl/cpan/Pod-Simple/lib/Pod/Simple/Subclassing.pod (revision de8cc8edbc71bd3e3bc7fbffa27ba0e564c37d8b)
1=head1 NAME
2
3Pod::Simple::Subclassing -- write a formatter as a Pod::Simple subclass
4
5=head1 SYNOPSIS
6
7  package Pod::SomeFormatter;
8  use Pod::Simple;
9  @ISA = qw(Pod::Simple);
10  $VERSION = '1.01';
11  use strict;
12
13  sub _handle_element_start {
14	my($parser, $element_name, $attr_hash_r) = @_;
15	...
16  }
17
18  sub _handle_element_end {
19	my($parser, $element_name, $attr_hash_r) = @_;
20	# NOTE: $attr_hash_r is only present when $element_name is "over" or "begin"
21	# The remaining code excerpts will mostly ignore this $attr_hash_r, as it is
22	# mostly useless. It is documented where "over-*" and "begin" events are
23	# documented.
24	...
25  }
26
27  sub _handle_text {
28	my($parser, $text) = @_;
29	...
30  }
31  1;
32
33=head1 DESCRIPTION
34
35This document is about using Pod::Simple to write a Pod processor,
36generally a Pod formatter. If you just want to know about using an
37existing Pod formatter, instead see its documentation and see also the
38docs in L<Pod::Simple>.
39
40B<The zeroeth step> in writing a Pod formatter is to make sure that there
41isn't already a decent one in CPAN. See L<http://search.cpan.org/>, and
42run a search on the name of the format you want to render to. Also
43consider joining the Pod People list
44L<http://lists.perl.org/showlist.cgi?name=pod-people> and asking whether
45anyone has a formatter for that format -- maybe someone cobbled one
46together but just hasn't released it.
47
48B<The first step> in writing a Pod processor is to read L<perlpodspec>,
49which contains information on writing a Pod parser (which has been
50largely taken care of by Pod::Simple), but also a lot of requirements
51and recommendations for writing a formatter.
52
53B<The second step> is to actually learn the format you're planning to
54format to -- or at least as much as you need to know to represent Pod,
55which probably isn't much.
56
57B<The third step> is to pick which of Pod::Simple's interfaces you want to
58use:
59
60=over
61
62=item Pod::Simple
63
64The basic L<Pod::Simple> interface that uses C<_handle_element_start()>,
65C<_handle_element_end()> and C<_handle_text()>.
66
67=item Pod::Simple::Methody
68
69The L<Pod::Simple::Methody> interface is event-based, similar to that of
70L<HTML::Parser> or L<XML::Parser>'s "Handlers".
71
72=item Pod::Simple::PullParser
73
74L<Pod::Simple::PullParser> provides a token-stream interface, sort of
75like L<HTML::TokeParser>'s interface.
76
77=item Pod::Simple::SimpleTree
78
79L<Pod::Simple::SimpleTree> provides a simple tree interface, rather like
80L<XML::Parser>'s "Tree" interface. Users familiar with XML handling will
81be comfortable with this interface. Users interested in outputting XML,
82should look into the modules that produce an XML representation of the
83Pod stream, notably L<Pod::Simple::XMLOutStream>; you can feed the output
84of such a class to whatever XML parsing system you are most at home with.
85
86=back
87
88B<The last step> is to write your code based on how the events (or tokens,
89or tree-nodes, or the XML, or however you're parsing) will map to
90constructs in the output format. Also be sure to consider how to escape
91text nodes containing arbitrary text, and what to do with text
92nodes that represent preformatted text (from verbatim sections).
93
94
95
96=head1 Events
97
98TODO intro... mention that events are supplied for implicits, like for
99missing >'s
100
101
102In the following section, we use XML to represent the event structure
103associated with a particular construct.  That is, TODO
104
105=over
106
107=item C<< $parser->_handle_element_start( I<element_name>, I<attr_hashref> ) >>
108
109=item C<< $parser->_handle_element_end( I<element_name>  ) >>
110
111=item C<< $parser->_handle_text(  I<text_string>  ) >>
112
113=back
114
115TODO describe
116
117
118=over
119
120=item events with an element_name of Document
121
122Parsing a document produces this event structure:
123
124  <Document start_line="543">
125	...all events...
126  </Document>
127
128The value of the I<start_line> attribute will be the line number of the first
129Pod directive in the document.
130
131If there is no Pod in the given document, then the
132event structure will be this:
133
134  <Document contentless="1" start_line="543">
135  </Document>
136
137In that case, the value of the I<start_line> attribute will not be meaningful;
138under current implementations, it will probably be the line number of the
139last line in the file.
140
141=item events with an element_name of Para
142
143Parsing a plain (non-verbatim, non-directive, non-data) paragraph in
144a Pod document produces this event structure:
145
146	<Para start_line="543">
147	  ...all events in this paragraph...
148	</Para>
149
150The value of the I<start_line> attribute will be the line number of the start
151of the paragraph.
152
153For example, parsing this paragraph of Pod:
154
155  The value of the I<start_line> attribute will be the
156  line number of the start of the paragraph.
157
158produces this event structure:
159
160	<Para start_line="129">
161	  The value of the
162	  <I>
163		start_line
164	  </I>
165	   attribute will be the line number of the first Pod directive
166	  in the document.
167	</Para>
168
169=item events with an element_name of B, C, F, or I.
170
171Parsing a BE<lt>...E<gt> formatting code (or of course any of its
172semantically identical syntactic variants
173S<BE<lt>E<lt> ... E<gt>E<gt>>,
174or S<BE<lt>E<lt>E<lt>E<lt> ... E<gt>E<gt>E<gt>E<gt>>, etc.)
175produces this event structure:
176
177	  <B>
178		...stuff...
179	  </B>
180
181Currently, there are no attributes conveyed.
182
183Parsing C, F, or I codes produce the same structure, with only a
184different element name.
185
186If your parser object has been set to accept other formatting codes,
187then they will be presented like these B/C/F/I codes -- i.e., without
188any attributes.
189
190=item events with an element_name of S
191
192Normally, parsing an SE<lt>...E<gt> sequence produces this event
193structure, just as if it were a B/C/F/I code:
194
195	  <S>
196		...stuff...
197	  </S>
198
199However, Pod::Simple (and presumably all derived parsers) offers the
200C<nbsp_for_S> option which, if enabled, will suppress all S events, and
201instead change all spaces in the content to non-breaking spaces. This is
202intended for formatters that output to a format that has no code that
203means the same as SE<lt>...E<gt>, but which has a code/character that
204means non-breaking space.
205
206=item events with an element_name of X
207
208Normally, parsing an XE<lt>...E<gt> sequence produces this event
209structure, just as if it were a B/C/F/I code:
210
211	  <X>
212		...stuff...
213	  </X>
214
215However, Pod::Simple (and presumably all derived parsers) offers the
216C<nix_X_codes> option which, if enabled, will suppress all X events
217and ignore their content.  For formatters/processors that don't use
218X events, this is presumably quite useful.
219
220
221=item events with an element_name of L
222
223Because the LE<lt>...E<gt> is the most complex construct in the
224language, it should not surprise you that the events it generates are
225the most complex in the language. Most of complexity is hidden away in
226the attribute values, so for those of you writing a Pod formatter that
227produces a non-hypertextual format, you can just ignore the attributes
228and treat an L event structure like a formatting element that
229(presumably) doesn't actually produce a change in formatting.  That is,
230the content of the L event structure (as opposed to its
231attributes) is always what text should be displayed.
232
233There are, at first glance, three kinds of L links: URL, man, and pod.
234
235When a LE<lt>I<some_url>E<gt> code is parsed, it produces this event
236structure:
237
238  <L content-implicit="yes" raw="that_url" to="that_url" type="url">
239	that_url
240  </L>
241
242The C<type="url"> attribute is always specified for this type of
243L code.
244
245For example, this Pod source:
246
247  L<http://www.perl.com/CPAN/authors/>
248
249produces this event structure:
250
251  <L content-implicit="yes" raw="http://www.perl.com/CPAN/authors/" to="http://www.perl.com/CPAN/authors/" type="url">
252	http://www.perl.com/CPAN/authors/
253  </L>
254
255When a LE<lt>I<manpage(section)>E<gt> code is parsed (and these are
256fairly rare and not terribly useful), it produces this event structure:
257
258  <L content-implicit="yes" raw="manpage(section)" to="manpage(section)" type="man">
259	manpage(section)
260  </L>
261
262The C<type="man"> attribute is always specified for this type of
263L code.
264
265For example, this Pod source:
266
267  L<crontab(5)>
268
269produces this event structure:
270
271  <L content-implicit="yes" raw="crontab(5)" to="crontab(5)" type="man">
272	crontab(5)
273  </L>
274
275In the rare cases where a man page link has a section specified, that text appears
276in a I<section> attribute. For example, this Pod source:
277
278  L<crontab(5)/"ENVIRONMENT">
279
280will produce this event structure:
281
282  <L content-implicit="yes" raw="crontab(5)/&quot;ENVIRONMENT&quot;" section="ENVIRONMENT" to="crontab(5)" type="man">
283	"ENVIRONMENT" in crontab(5)
284  </L>
285
286In the rare case where the Pod document has code like
287LE<lt>I<sometext>|I<manpage(section)>E<gt>, then the I<sometext> will appear
288as the content of the element, the I<manpage(section)> text will appear
289only as the value of the I<to> attribute, and there will be no
290C<content-implicit="yes"> attribute (whose presence means that the Pod parser
291had to infer what text should appear as the link text -- as opposed to
292cases where that attribute is absent, which means that the Pod parser did
293I<not> have to infer the link text, because that L code explicitly specified
294some link text.)
295
296For example, this Pod source:
297
298  L<hell itself!|crontab(5)>
299
300will produce this event structure:
301
302  <L raw="hell itself!|crontab(5)" to="crontab(5)" type="man">
303	hell itself!
304  </L>
305
306The last type of L structure is for links to/within Pod documents. It is
307the most complex because it can have a I<to> attribute, I<or> a
308I<section> attribute, or both. The C<type="pod"> attribute is always
309specified for this type of L code.
310
311In the most common case, the simple case of a LE<lt>podpageE<gt> code
312produces this event structure:
313
314  <L content-implicit="yes" raw="podpage" to="podpage" type="pod">
315	podpage
316  </L>
317
318For example, this Pod source:
319
320  L<Net::Ping>
321
322produces this event structure:
323
324  <L content-implicit="yes" raw="Net::Ping" to="Net::Ping" type="pod">
325	Net::Ping
326  </L>
327
328In cases where there is link-text explicitly specified, it
329is to be found in the content of the element (and not the
330attributes), just as with the LE<lt>I<sometext>|I<manpage(section)>E<gt>
331case discussed above.  For example, this Pod source:
332
333  L<Perl Error Messages|perldiag>
334
335produces this event structure:
336
337  <L raw="Perl Error Messages|perldiag" to="perldiag" type="pod">
338	Perl Error Messages
339  </L>
340
341In cases of links to a section in the current Pod document,
342there is a I<section> attribute instead of a I<to> attribute.
343For example, this Pod source:
344
345  L</"Member Data">
346
347produces this event structure:
348
349  <L content-implicit="yes" raw="/&quot;Member Data&quot;" section="Member Data" type="pod">
350	"Member Data"
351  </L>
352
353As another example, this Pod source:
354
355  L<the various attributes|/"Member Data">
356
357produces this event structure:
358
359  <L raw="the various attributes|/&quot;Member Data&quot;" section="Member Data" type="pod">
360	the various attributes
361  </L>
362
363In cases of links to a section in a different Pod document,
364there are both a I<section> attribute and a L<to> attribute.
365For example, this Pod source:
366
367  L<perlsyn/"Basic BLOCKs and Switch Statements">
368
369produces this event structure:
370
371  <L content-implicit="yes" raw="perlsyn/&quot;Basic BLOCKs and Switch Statements&quot;" section="Basic BLOCKs and Switch Statements" to="perlsyn" type="pod">
372	"Basic BLOCKs and Switch Statements" in perlsyn
373  </L>
374
375As another example, this Pod source:
376
377  L<SWITCH statements|perlsyn/"Basic BLOCKs and Switch Statements">
378
379produces this event structure:
380
381  <L raw="SWITCH statements|perlsyn/&quot;Basic BLOCKs and Switch Statements&quot;" section="Basic BLOCKs and Switch Statements" to="perlsyn" type="pod">
382	SWITCH statements
383  </L>
384
385Incidentally, note that we do not distinguish between these syntaxes:
386
387  L</"Member Data">
388  L<"Member Data">
389  L</Member Data>
390  L<Member Data>    [deprecated syntax]
391
392That is, they all produce the same event structure (for the most part), namely:
393
394  <L content-implicit="yes" raw="$depends_on_syntax" section="Member Data" type="pod">
395	&#34;Member Data&#34;
396  </L>
397
398The I<raw> attribute depends on what the raw content of the C<LE<lt>E<gt>> is,
399so that is why the event structure is the same "for the most part".
400
401If you have not guessed it yet, the I<raw> attribute contains the raw,
402original, unescaped content of the C<LE<lt>E<gt>> formatting code. In addition
403to the examples above, take notice of the following event structure produced
404by the following C<LE<lt>E<gt>> formatting code.
405
406  L<click B<here>|page/About the C<-M> switch>
407
408  <L raw="click B<here>|page/About the C<-M> switch" section="About the -M switch" to="page" type="pod">
409	click B<here>
410  </L>
411
412Specifically, notice that the formatting codes are present and unescaped
413in I<raw>.
414
415There is a known bug in the I<raw> attribute where any surrounding whitespace
416is condensed into a single ' '. For example, given LE<60>   linkE<62>, I<raw>
417will be " link".
418
419=item events with an element_name of E or Z
420
421While there are Pod codes EE<lt>...E<gt> and ZE<lt>E<gt>, these
422I<do not> produce any E or Z events -- that is, there are no such
423events as E or Z.
424
425=item events with an element_name of Verbatim
426
427When a Pod verbatim paragraph (AKA "codeblock") is parsed, it
428produces this event structure:
429
430  <Verbatim start_line="543" xml:space="preserve">
431	...text...
432  </Verbatim>
433
434The value of the I<start_line> attribute will be the line number of the
435first line of this verbatim block.  The I<xml:space> attribute is always
436present, and always has the value "preserve".
437
438The text content will have tabs already expanded.
439
440
441=item events with an element_name of head1 .. head4
442
443When a "=head1 ..." directive is parsed, it produces this event
444structure:
445
446  <head1>
447	...stuff...
448  </head1>
449
450For example, a directive consisting of this:
451
452  =head1 Options to C<new> et al.
453
454will produce this event structure:
455
456  <head1 start_line="543">
457	Options to
458	<C>
459	  new
460	</C>
461	 et al.
462  </head1>
463
464"=head2" through "=head4" directives are the same, except for the element
465names in the event structure.
466
467=item events with an element_name of encoding
468
469In the default case, the events corresponding to C<=encoding> directives
470are not emitted. They are emitted if C<keep_encoding_directive> is true.
471In that case they produce event structures like
472L</"events with an element_name of head1 .. head4"> above.
473
474=item events with an element_name of over-bullet
475
476When an "=over ... Z<>=back" block is parsed where the items are
477a bulleted list, it will produce this event structure:
478
479  <over-bullet indent="4" start_line="543">
480	<item-bullet start_line="545">
481	  ...Stuff...
482	</item-bullet>
483	...more item-bullets...
484  </over-bullet fake-closer="1">
485
486The attribute I<fake-closer> is only present if it is a true value; it is not
487present if it is a false value. It is shown in the above example to illustrate
488where the attribute is (in the B<closing> tag). It signifies that the C<=over>
489did not have a matching C<=back>, and thus Pod::Simple had to create a fake
490closer.
491
492For example, this Pod source:
493
494  =over
495
496  =item *
497
498  Something
499
500  =back
501
502Would produce an event structure that does B<not> have the I<fake-closer>
503attribute, whereas this Pod source:
504
505  =over
506
507  =item *
508
509  Gasp! An unclosed =over block!
510
511would. The rest of the over-* examples will not demonstrate this attribute,
512but they all can have it. See L<Pod::Checker>'s source for an example of this
513attribute being used.
514
515The value of the I<indent> attribute is whatever value is after the
516"=over" directive, as in "=over 8".  If no such value is specified
517in the directive, then the I<indent> attribute has the value "4".
518
519For example, this Pod source:
520
521  =over
522
523  =item *
524
525  Stuff
526
527  =item *
528
529  Bar I<baz>!
530
531  =back
532
533produces this event structure:
534
535  <over-bullet indent="4" start_line="10">
536	<item-bullet start_line="12">
537	  Stuff
538	</item-bullet>
539	<item-bullet start_line="14">
540	  Bar <I>baz</I>!
541	</item-bullet>
542  </over-bullet>
543
544=item events with an element_name of over-number
545
546When an "=over ... Z<>=back" block is parsed where the items are
547a numbered list, it will produce this event structure:
548
549  <over-number indent="4" start_line="543">
550	<item-number number="1" start_line="545">
551	  ...Stuff...
552	</item-number>
553	...more item-number...
554  </over-bullet>
555
556This is like the "over-bullet" event structure; but note that the contents
557are "item-number" instead of "item-bullet", and note that they will have
558a "number" attribute, which some formatters/processors may ignore
559(since, for example, there's no need for it in HTML when producing
560an "<UL><LI>...</LI>...</UL>" structure), but which any processor may use.
561
562Note that the values for the I<number> attributes of "item-number"
563elements in a given "over-number" area I<will> start at 1 and go up by
564one each time.  If the Pod source doesn't follow that order (even though
565it really should!), whatever numbers it has will be ignored (with
566the correct values being put in the I<number> attributes), and an error
567message might be issued to the user.
568
569=item events with an element_name of over-text
570
571These events are somewhat unlike the other over-*
572structures, as far as what their contents are.  When
573an "=over ... Z<>=back" block is parsed where the items are
574a list of text "subheadings", it will produce this event structure:
575
576  <over-text indent="4" start_line="543">
577	<item-text>
578	  ...stuff...
579	</item-text>
580	...stuff (generally Para or Verbatim elements)...
581	<item-text>
582	...more item-text and/or stuff...
583  </over-text>
584
585The I<indent> and I<fake-closer> attributes are as with the other over-* events.
586
587For example, this Pod source:
588
589  =over
590
591  =item Foo
592
593  Stuff
594
595  =item Bar I<baz>!
596
597  Quux
598
599  =back
600
601produces this event structure:
602
603  <over-text indent="4" start_line="20">
604	<item-text start_line="22">
605	  Foo
606	</item-text>
607	<Para start_line="24">
608	  Stuff
609	</Para>
610	<item-text start_line="26">
611	  Bar
612		<I>
613		  baz
614		</I>
615	  !
616	</item-text>
617	<Para start_line="28">
618	  Quux
619	</Para>
620  </over-text>
621
622
623
624=item events with an element_name of over-block
625
626These events are somewhat unlike the other over-*
627structures, as far as what their contents are.  When
628an "=over ... Z<>=back" block is parsed where there are no items,
629it will produce this event structure:
630
631  <over-block indent="4" start_line="543">
632	...stuff (generally Para or Verbatim elements)...
633  </over-block>
634
635The I<indent> and I<fake-closer> attributes are as with the other over-* events.
636
637For example, this Pod source:
638
639  =over
640
641  For cutting off our trade with all parts of the world
642
643  For transporting us beyond seas to be tried for pretended offenses
644
645  He is at this time transporting large armies of foreign mercenaries to
646  complete the works of death, desolation and tyranny, already begun with
647  circumstances of cruelty and perfidy scarcely paralleled in the most
648  barbarous ages, and totally unworthy the head of a civilized nation.
649
650  =back
651
652will produce this event structure:
653
654  <over-block indent="4" start_line="2">
655	<Para start_line="4">
656	  For cutting off our trade with all parts of the world
657	</Para>
658	<Para start_line="6">
659	  For transporting us beyond seas to be tried for pretended offenses
660	</Para>
661	<Para start_line="8">
662	  He is at this time transporting large armies of [...more text...]
663	</Para>
664  </over-block>
665
666=item events with an element_name of over-empty
667
668B<Note: These events are only triggered if C<parse_empty_lists()> is set to a
669true value.>
670
671These events are somewhat unlike the other over-* structures, as far as what
672their contents are.  When an "=over ... Z<>=back" block is parsed where there
673is no content, it will produce this event structure:
674
675  <over-empty indent="4" start_line="543">
676  </over-empty>
677
678The I<indent> and I<fake-closer> attributes are as with the other over-* events.
679
680For example, this Pod source:
681
682  =over
683
684  =over
685
686  =back
687
688  =back
689
690will produce this event structure:
691
692  <over-block indent="4" start_line="1">
693	<over-empty indent="4" start_line="3">
694	</over-empty>
695  </over-block>
696
697Note that the outer C<=over> is a block because it has no C<=item>s but still
698has content: the inner C<=over>. The inner C<=over>, in turn, is completely
699empty, and is treated as such.
700
701=item events with an element_name of item-bullet
702
703See L</"events with an element_name of over-bullet">, above.
704
705=item events with an element_name of item-number
706
707See L</"events with an element_name of over-number">, above.
708
709=item events with an element_name of item-text
710
711See L</"events with an element_name of over-text">, above.
712
713=item events with an element_name of for
714
715TODO...
716
717=item events with an element_name of Data
718
719TODO...
720
721=back
722
723
724
725=head1 More Pod::Simple Methods
726
727Pod::Simple provides a lot of methods that aren't generally interesting
728to the end user of an existing Pod formatter, but some of which you
729might find useful in writing a Pod formatter. They are listed below. The
730first several methods (the accept_* methods) are for declaring the
731capabilities of your parser, notably what C<=for I<targetname>> sections
732it's interested in, what extra NE<lt>...E<gt> codes it accepts beyond
733the ones described in the I<perlpod>.
734
735=over
736
737=item C<< $parser->accept_targets( I<SOMEVALUE> ) >>
738
739As the parser sees sections like:
740
741	=for html  <img src="fig1.jpg">
742
743or
744
745	=begin html
746
747	  <img src="fig1.jpg">
748
749	=end html
750
751...the parser will ignore these sections unless your subclass has
752specified that it wants to see sections targeted to "html" (or whatever
753the formatter name is).
754
755If you want to process all sections, even if they're not targeted for you,
756call this before you start parsing:
757
758  $parser->accept_targets('*');
759
760=item C<< $parser->accept_targets_as_text(  I<SOMEVALUE>  ) >>
761
762This is like accept_targets, except that it specifies also that the
763content of sections for this target should be treated as Pod text even
764if the target name in "=for I<targetname>" doesn't start with a ":".
765
766At time of writing, I don't think you'll need to use this.
767
768
769=item C<< $parser->accept_codes( I<Codename>, I<Codename>...  ) >>
770
771This tells the parser that you accept additional formatting codes,
772beyond just the standard ones (I B C L F S X, plus the two weird ones
773you don't actually see in the parse tree, Z and E). For example, to also
774accept codes "N", "R", and "W":
775
776	$parser->accept_codes( qw( N R W ) );
777
778B<TODO: document how this interacts with =extend, and long element names>
779
780
781=item C<< $parser->accept_directive_as_data( I<directive_name> ) >>
782
783=item C<< $parser->accept_directive_as_verbatim( I<directive_name> ) >>
784
785=item C<< $parser->accept_directive_as_processed( I<directive_name> ) >>
786
787In the unlikely situation that you need to tell the parser that you will
788accept additional directives ("=foo" things), you need to first set the
789parser to treat its content as data (i.e., not really processed at
790all), or as verbatim (mostly just expanding tabs), or as processed text
791(parsing formatting codes like BE<lt>...E<gt>).
792
793For example, to accept a new directive "=method", you'd presumably
794use:
795
796	$parser->accept_directive_as_processed("method");
797
798so that you could have Pod lines like:
799
800	=method I<$whatever> thing B<um>
801
802Making up your own directives breaks compatibility with other Pod
803formatters, in a way that using "=for I<target> ..." lines doesn't;
804however, you may find this useful if you're making a Pod superset
805format where you don't need to worry about compatibility.
806
807
808=item C<< $parser->nbsp_for_S( I<BOOLEAN> ); >>
809
810Setting this attribute to a true value (and by default it is false) will
811turn "SE<lt>...E<gt>" sequences into sequences of words separated by
812C<\xA0> (non-breaking space) characters. For example, it will take this:
813
814	I like S<Dutch apple pie>, don't you?
815
816and treat it as if it were:
817
818	I like DutchE<nbsp>appleE<nbsp>pie, don't you?
819
820This is handy for output formats that don't have anything quite like an
821"SE<lt>...E<gt>" code, but which do have a code for non-breaking space.
822
823There is currently no method for going the other way; but I can
824probably provide one upon request.
825
826
827=item C<< $parser->version_report() >>
828
829This returns a string reporting the $VERSION value from your module (and
830its classname) as well as the $VERSION value of Pod::Simple.  Note that
831L<perlpodspec> requires output formats (wherever possible) to note
832this detail in a comment in the output format.  For example, for
833some kind of SGML output format:
834
835	print OUT "<!-- \n", $parser->version_report, "\n -->";
836
837
838=item C<< $parser->pod_para_count() >>
839
840This returns the count of Pod paragraphs seen so far.
841
842
843=item C<< $parser->line_count() >>
844
845This is the current line number being parsed. But you might find the
846"line_number" event attribute more accurate, when it is present.
847
848
849=item C<< $parser->nix_X_codes(  I<SOMEVALUE>  ) >>
850
851This attribute, when set to a true value (and it is false by default)
852ignores any "XE<lt>...E<gt>" sequences in the document being parsed.
853Many formats don't actually use the content of these codes, so have
854no reason to process them.
855
856=item C<< $parser->keep_encoding_directive(  I<SOMEVALUE>  ) >>
857
858This attribute, when set to a true value (it is false by default)
859will keep C<=encoding> and its content in the event structure. Most
860formats don't actually need to process the content of an C<=encoding>
861directive, even when this directive sets the encoding and the
862processor makes use of the encoding information. Indeed, it is
863possible to know the encoding without processing the directive
864content.
865
866=item C<< $parser->merge_text(  I<SOMEVALUE>  ) >>
867
868This attribute, when set to a true value (and it is false by default)
869makes sure that only one event (or token, or node) will be created
870for any single contiguous sequence of text.  For example, consider
871this somewhat contrived example:
872
873	I just LOVE Z<>hotE<32>apple pie!
874
875When that is parsed and events are about to be called on it, it may
876actually seem to be four different text events, one right after another:
877one event for "I just LOVE ", one for "hot", one for " ", and one for
878"apple pie!". But if you have merge_text on, then you're guaranteed
879that it will be fired as one text event:  "I just LOVE hot apple pie!".
880
881
882=item C<< $parser->code_handler(  I<CODE_REF>  ) >>
883
884This specifies code that should be called when a code line is seen
885(i.e., a line outside of the Pod).  Normally this is undef, meaning
886that no code should be called.  If you provide a routine, it should
887start out like this:
888
889	sub get_code_line {  # or whatever you'll call it
890	  my($line, $line_number, $parser) = @_;
891	  ...
892	}
893
894Note, however, that sometimes the Pod events aren't processed in exactly
895the same order as the code lines are -- i.e., if you have a file with
896Pod, then code, then more Pod, sometimes the code will be processed (via
897whatever you have code_handler call) before the all of the preceding Pod
898has been processed.
899
900
901=item C<< $parser->cut_handler(  I<CODE_REF>  ) >>
902
903This is just like the code_handler attribute, except that it's for
904"=cut" lines, not code lines. The same caveats apply. "=cut" lines are
905unlikely to be interesting, but this is included for completeness.
906
907
908=item C<< $parser->pod_handler(  I<CODE_REF>  ) >>
909
910This is just like the code_handler attribute, except that it's for
911"=pod" lines, not code lines. The same caveats apply. "=pod" lines are
912unlikely to be interesting, but this is included for completeness.
913
914
915=item C<< $parser->whiteline_handler(  I<CODE_REF>  ) >>
916
917This is just like the code_handler attribute, except that it's for
918lines that are seemingly blank but have whitespace (" " and/or "\t") on them,
919not code lines. The same caveats apply. These lines are unlikely to be
920interesting, but this is included for completeness.
921
922
923=item C<< $parser->whine( I<linenumber>, I<complaint string> ) >>
924
925This notes a problem in the Pod, which will be reported in the "Pod
926Errors" section of the document and/or sent to STDERR, depending on the
927values of the attributes C<no_whining>, C<no_errata_section>, and
928C<complain_stderr>.
929
930=item C<< $parser->scream( I<linenumber>, I<complaint string> ) >>
931
932This notes an error like C<whine> does, except that it is not
933suppressible with C<no_whining>. This should be used only for very
934serious errors.
935
936
937=item C<< $parser->source_dead(1) >>
938
939This aborts parsing of the current document, by switching on the flag
940that indicates that EOF has been seen.  In particularly drastic cases,
941you might want to do this.  It's rather nicer than just calling
942C<die>!
943
944=item C<< $parser->hide_line_numbers( I<SOMEVALUE> ) >>
945
946Some subclasses that indiscriminately dump event attributes (well,
947except for ones beginning with "~") can use this object attribute for
948refraining to dump the "start_line" attribute.
949
950=item C<< $parser->no_whining( I<SOMEVALUE> ) >>
951
952This attribute, if set to true, will suppress reports of non-fatal
953error messages.  The default value is false, meaning that complaints
954I<are> reported.  How they get reported depends on the values of
955the attributes C<no_errata_section> and C<complain_stderr>.
956
957=item C<< $parser->no_errata_section( I<SOMEVALUE> ) >>
958
959This attribute, if set to true, will suppress generation of an errata
960section.  The default value is false -- i.e., an errata section will be
961generated.
962
963=item C<< $parser->complain_stderr( I<SOMEVALUE> ) >>
964
965This attribute, if set to true will send complaints to STDERR.  The
966default value is false -- i.e., complaints do not go to STDERR.
967
968=item C<< $parser->bare_output( I<SOMEVALUE> ) >>
969
970Some formatter subclasses use this as a flag for whether output should
971have prologue and epilogue code omitted. For example, setting this to
972true for an HTML formatter class should omit the
973"<html><head><title>...</title><body>..." prologue and the
974"</body></html>" epilogue.
975
976If you want to set this to true, you should probably also set
977C<no_whining> or at least C<no_errata_section> to true.
978
979=item C<< $parser->preserve_whitespace( I<SOMEVALUE> ) >>
980
981If you set this attribute to a true value, the parser will try to
982preserve whitespace in the output.  This means that such formatting
983conventions as two spaces after periods will be preserved by the parser.
984This is primarily useful for output formats that treat whitespace as
985significant (such as text or *roff, but not HTML).
986
987=item C<< $parser->parse_empty_lists( I<SOMEVALUE> ) >>
988
989If this attribute is set to true, the parser will not ignore empty
990C<=over>/C<=back> blocks. The type of C<=over> will be I<empty>, documented
991above, L<events with an element_name of over-empty>.
992
993=back
994
995=head1 SEE ALSO
996
997L<Pod::Simple> -- event-based Pod-parsing framework
998
999L<Pod::Simple::Methody> -- like Pod::Simple, but each sort of event
1000calls its own method (like C<start_head3>)
1001
1002L<Pod::Simple::PullParser> -- a Pod-parsing framework like Pod::Simple,
1003but with a token-stream interface
1004
1005L<Pod::Simple::SimpleTree> -- a Pod-parsing framework like Pod::Simple,
1006but with a tree interface
1007
1008L<Pod::Simple::Checker> -- a simple Pod::Simple subclass that reads
1009documents, and then makes a plaintext report of any errors found in the
1010document
1011
1012L<Pod::Simple::DumpAsXML> -- for dumping Pod documents as tidily
1013indented XML, showing each event on its own line
1014
1015L<Pod::Simple::XMLOutStream> -- dumps a Pod document as XML (without
1016introducing extra whitespace as Pod::Simple::DumpAsXML does).
1017
1018L<Pod::Simple::DumpAsText> -- for dumping Pod documents as tidily
1019indented text, showing each event on its own line
1020
1021L<Pod::Simple::LinkSection> -- class for objects representing the values
1022of the TODO and TODO attributes of LE<lt>...E<gt> elements
1023
1024L<Pod::Escapes> -- the module that Pod::Simple uses for evaluating
1025EE<lt>...E<gt> content
1026
1027L<Pod::Simple::Text> -- a simple plaintext formatter for Pod
1028
1029L<Pod::Simple::TextContent> -- like Pod::Simple::Text, but
1030makes no effort for indent or wrap the text being formatted
1031
1032L<Pod::Simple::HTML> -- a simple HTML formatter for Pod
1033
1034L<perlpod|perlpod>
1035
1036L<perlpodspec|perlpodspec>
1037
1038L<perldoc>
1039
1040=head1 SUPPORT
1041
1042Questions or discussion about POD and Pod::Simple should be sent to the
1043pod-people@perl.org mail list. Send an empty email to
1044pod-people-subscribe@perl.org to subscribe.
1045
1046This module is managed in an open GitHub repository,
1047L<https://github.com/perl-pod/pod-simple/>. Feel free to fork and contribute, or
1048to clone L<git://github.com/perl-pod/pod-simple.git> and send patches!
1049
1050Patches against Pod::Simple are welcome. Please send bug reports to
1051<bug-pod-simple@rt.cpan.org>.
1052
1053=head1 COPYRIGHT AND DISCLAIMERS
1054
1055Copyright (c) 2002 Sean M. Burke.
1056
1057This library is free software; you can redistribute it and/or modify it
1058under the same terms as Perl itself.
1059
1060This program is distributed in the hope that it will be useful, but
1061without any warranty; without even the implied warranty of
1062merchantability or fitness for a particular purpose.
1063
1064=head1 AUTHOR
1065
1066Pod::Simple was created by Sean M. Burke <sburke@cpan.org>.
1067But don't bother him, he's retired.
1068
1069Pod::Simple is maintained by:
1070
1071=over
1072
1073=item * Allison Randal C<allison@perl.org>
1074
1075=item * Hans Dieter Pearcey C<hdp@cpan.org>
1076
1077=item * David E. Wheeler C<dwheeler@cpan.org>
1078
1079=back
1080
1081=for notes
1082Hm, my old podchecker version (1.2) says:
1083 *** WARNING: node 'http://search.cpan.org/' contains non-escaped | or / at line 38 in file Subclassing.pod
1084 *** WARNING: node 'http://lists.perl.org/showlist.cgi?name=pod-people' contains non-escaped | or / at line 41 in file Subclassing.pod
1085Yes, L<...> is hard.
1086
1087
1088=cut
1089