{
    "content": [
        {
            "type": "text",
            "text": "# Pod::Simple::Subclassing (perldoc)\n\n**Summary:** Pod::Simple::Subclassing -- write a formatter as a Pod::Simple subclass\n\n**Synopsis:** package Pod::SomeFormatter;\nuse Pod::Simple;\n@ISA = qw(Pod::Simple);\n$VERSION = '1.01';\nuse strict;\nsub handleelementstart {\nmy($parser, $elementname, $attrhashr) = @;\n...\n}\nsub handleelementend {\nmy($parser, $elementname, $attrhashr) = @;\n# NOTE: $attrhashr is only present when $elementname is \"over\" or \"begin\"\n# The remaining code excerpts will mostly ignore this $attrhashr, as it is\n# mostly useless. It is documented where \"over-*\" and \"begin\" events are\n# documented.\n...\n}\nsub handletext {\nmy($parser, $text) = @;\n...\n}\n1;\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (26 lines)\n- **DESCRIPTION** (43 lines)\n- **Events** (558 lines)\n- **More Pod::Simple Methods** (200 lines)\n- **SEE ALSO** (40 lines)\n- **SUPPORT** (10 lines)\n- **COPYRIGHT AND DISCLAIMERS** (8 lines)\n- **AUTHOR** (10 lines)\n\n## Full Content\n\n### NAME\n\nPod::Simple::Subclassing -- write a formatter as a Pod::Simple subclass\n\n### SYNOPSIS\n\npackage Pod::SomeFormatter;\nuse Pod::Simple;\n@ISA = qw(Pod::Simple);\n$VERSION = '1.01';\nuse strict;\n\nsub handleelementstart {\nmy($parser, $elementname, $attrhashr) = @;\n...\n}\n\nsub handleelementend {\nmy($parser, $elementname, $attrhashr) = @;\n# NOTE: $attrhashr is only present when $elementname is \"over\" or \"begin\"\n# The remaining code excerpts will mostly ignore this $attrhashr, as it is\n# mostly useless. It is documented where \"over-*\" and \"begin\" events are\n# documented.\n...\n}\n\nsub handletext {\nmy($parser, $text) = @;\n...\n}\n1;\n\n### DESCRIPTION\n\nThis document is about using Pod::Simple to write a Pod processor, generally a Pod formatter. If\nyou just want to know about using an existing Pod formatter, instead see its documentation and\nsee also the docs in Pod::Simple.\n\nThe zeroeth step in writing a Pod formatter is to make sure that there isn't already a decent\none in CPAN. See <http://search.cpan.org/>, and run a search on the name of the format you want\nto render to. Also consider joining the Pod People list\n<http://lists.perl.org/showlist.cgi?name=pod-people> and asking whether anyone has a formatter\nfor that format -- maybe someone cobbled one together but just hasn't released it.\n\nThe first step in writing a Pod processor is to read perlpodspec, which contains information on\nwriting a Pod parser (which has been largely taken care of by Pod::Simple), but also a lot of\nrequirements and recommendations for writing a formatter.\n\nThe second step is to actually learn the format you're planning to format to -- or at least as\nmuch as you need to know to represent Pod, which probably isn't much.\n\nThe third step is to pick which of Pod::Simple's interfaces you want to use:\n\nPod::Simple\nThe basic Pod::Simple interface that uses \"handleelementstart()\", \"handleelementend()\"\nand \"handletext()\".\n\nPod::Simple::Methody\nThe Pod::Simple::Methody interface is event-based, similar to that of HTML::Parser or\nXML::Parser's \"Handlers\".\n\nPod::Simple::PullParser\nPod::Simple::PullParser provides a token-stream interface, sort of like HTML::TokeParser's\ninterface.\n\nPod::Simple::SimpleTree\nPod::Simple::SimpleTree provides a simple tree interface, rather like XML::Parser's \"Tree\"\ninterface. Users familiar with XML handling will be comfortable with this interface. Users\ninterested in outputting XML, should look into the modules that produce an XML\nrepresentation of the Pod stream, notably Pod::Simple::XMLOutStream; you can feed the output\nof such a class to whatever XML parsing system you are most at home with.\n\nThe last step is to write your code based on how the events (or tokens, or tree-nodes, or the\nXML, or however you're parsing) will map to constructs in the output format. Also be sure to\nconsider how to escape text nodes containing arbitrary text, and what to do with text nodes that\nrepresent preformatted text (from verbatim sections).\n\n### Events\n\nTODO intro... mention that events are supplied for implicits, like for missing >'s\n\nIn the following section, we use XML to represent the event structure associated with a\nparticular construct. That is, an opening tag represents the element start, the attributes of\nthat opening tag are the attributes given to the callback, and the closing tag represents the\nend element.\n\nThree callback methods must be supplied by a class extending Pod::Simple to receive the\ncorresponding event:\n\n\"$parser->handleelementstart( *elementname*, *attrhashref* )\"\n\"$parser->handleelementend( *elementname* )\"\n\"$parser->handletext( *textstring* )\"\n\nHere's the comprehensive list of values you can expect as *elementname* in your implementation\nof \"handleelementstart\" and \"handleelementend\"::\n\nevents with an elementname of Document\nParsing a document produces this event structure:\n\n<Document startline=\"543\">\n...all events...\n</Document>\n\nThe value of the *startline* attribute will be the line number of the first Pod directive\nin the document.\n\nIf there is no Pod in the given document, then the event structure will be this:\n\n<Document contentless=\"1\" startline=\"543\">\n</Document>\n\nIn that case, the value of the *startline* attribute will not be meaningful; under current\nimplementations, it will probably be the line number of the last line in the file.\n\nevents with an elementname of Para\nParsing a plain (non-verbatim, non-directive, non-data) paragraph in a Pod document produces\nthis event structure:\n\n<Para startline=\"543\">\n...all events in this paragraph...\n</Para>\n\nThe value of the *startline* attribute will be the line number of the start of the\nparagraph.\n\nFor example, parsing this paragraph of Pod:\n\nThe value of the I<startline> attribute will be the\nline number of the start of the paragraph.\n\nproduces this event structure:\n\n<Para startline=\"129\">\nThe value of the\n<I>\nstartline\n</I>\nattribute will be the line number of the first Pod directive\nin the document.\n</Para>\n\nevents with an elementname of B, C, F, or I.\nParsing a B<...> formatting code (or of course any of its semantically identical syntactic\nvariants B<< ... >>, or B<<<< ... >>>>, etc.) produces this event structure:\n\n<B>\n...stuff...\n</B>\n\nCurrently, there are no attributes conveyed.\n\nParsing C, F, or I codes produce the same structure, with only a different element name.\n\nIf your parser object has been set to accept other formatting codes, then they will be\npresented like these B/C/F/I codes -- i.e., without any attributes.\n\nevents with an elementname of S\nNormally, parsing an S<...> sequence produces this event structure, just as if it were a\nB/C/F/I code:\n\n<S>\n...stuff...\n</S>\n\nHowever, Pod::Simple (and presumably all derived parsers) offers the \"nbspforS\" option\nwhich, if enabled, will suppress all S events, and instead change all spaces in the content\nto non-breaking spaces. This is intended for formatters that output to a format that has no\ncode that means the same as S<...>, but which has a code/character that means non-breaking\nspace.\n\nevents with an elementname of X\nNormally, parsing an X<...> sequence produces this event structure, just as if it were a\nB/C/F/I code:\n\n<X>\n...stuff...\n</X>\n\nHowever, Pod::Simple (and presumably all derived parsers) offers the \"nixXcodes\" option\nwhich, if enabled, will suppress all X events and ignore their content. For\nformatters/processors that don't use X events, this is presumably quite useful.\n\nevents with an elementname of L\nBecause the L<...> is the most complex construct in the language, it should not surprise you\nthat the events it generates are the most complex in the language. Most of complexity is\nhidden away in the attribute values, so for those of you writing a Pod formatter that\nproduces a non-hypertextual format, you can just ignore the attributes and treat an L event\nstructure like a formatting element that (presumably) doesn't actually produce a change in\nformatting. That is, the content of the L event structure (as opposed to its attributes) is\nalways what text should be displayed.\n\nThere are, at first glance, three kinds of L links: URL, man, and pod.\n\nWhen a L<*someurl*> code is parsed, it produces this event structure:\n\n<L content-implicit=\"yes\" raw=\"thaturl\" to=\"thaturl\" type=\"url\">\nthaturl\n</L>\n\nThe \"type=\"url\"\" attribute is always specified for this type of L code.\n\nFor example, this Pod source:\n\nL<http://www.perl.com/CPAN/authors/>\n\nproduces this event structure:\n\n<L content-implicit=\"yes\" raw=\"http://www.perl.com/CPAN/authors/\" to=\"http://www.perl.com/CPAN/authors/\" type=\"url\">\nhttp://www.perl.com/CPAN/authors/\n</L>\n\nWhen a L<*manpage(section)*> code is parsed (and these are fairly rare and not terribly\nuseful), it produces this event structure:\n\n<L content-implicit=\"yes\" raw=\"manpage(section)\" to=\"manpage(section)\" type=\"man\">\nmanpage(section)\n</L>\n\nThe \"type=\"man\"\" attribute is always specified for this type of L code.\n\nFor example, this Pod source:\n\nL<crontab(5)>\n\nproduces this event structure:\n\n<L content-implicit=\"yes\" raw=\"crontab(5)\" to=\"crontab(5)\" type=\"man\">\ncrontab(5)\n</L>\n\nIn the rare cases where a man page link has a section specified, that text appears in a\n*section* attribute. For example, this Pod source:\n\nL<crontab(5)/\"ENVIRONMENT\">\n\nwill produce this event structure:\n\n<L content-implicit=\"yes\" raw=\"crontab(5)/&quot;ENVIRONMENT&quot;\" section=\"ENVIRONMENT\" to=\"crontab(5)\" type=\"man\">\n\"ENVIRONMENT\" in crontab(5)\n</L>\n\nIn the rare case where the Pod document has code like L<*sometext*|*manpage(section)*>, then\nthe *sometext* will appear as the content of the element, the *manpage(section)* text will\nappear only as the value of the *to* attribute, and there will be no\n\"content-implicit=\"yes\"\" attribute (whose presence means that the Pod parser had to infer\nwhat text should appear as the link text -- as opposed to cases where that attribute is\nabsent, which means that the Pod parser did *not* have to infer the link text, because that\nL code explicitly specified some link text.)\n\nFor example, this Pod source:\n\nL<hell itself!|crontab(5)>\n\nwill produce this event structure:\n\n<L raw=\"hell itself!|crontab(5)\" to=\"crontab(5)\" type=\"man\">\nhell itself!\n</L>\n\nThe last type of L structure is for links to/within Pod documents. It is the most complex\nbecause it can have a *to* attribute, *or* a *section* attribute, or both. The \"type=\"pod\"\"\nattribute is always specified for this type of L code.\n\nIn the most common case, the simple case of a L<podpage> code produces this event structure:\n\n<L content-implicit=\"yes\" raw=\"podpage\" to=\"podpage\" type=\"pod\">\npodpage\n</L>\n\nFor example, this Pod source:\n\nL<Net::Ping>\n\nproduces this event structure:\n\n<L content-implicit=\"yes\" raw=\"Net::Ping\" to=\"Net::Ping\" type=\"pod\">\nNet::Ping\n</L>\n\nIn cases where there is link-text explicitly specified, it is to be found in the content of\nthe element (and not the attributes), just as with the L<*sometext*|*manpage(section)*> case\ndiscussed above. For example, this Pod source:\n\nL<Perl Error Messages|perldiag>\n\nproduces this event structure:\n\n<L raw=\"Perl Error Messages|perldiag\" to=\"perldiag\" type=\"pod\">\nPerl Error Messages\n</L>\n\nIn cases of links to a section in the current Pod document, there is a *section* attribute\ninstead of a *to* attribute. For example, this Pod source:\n\nL</\"Member Data\">\n\nproduces this event structure:\n\n<L content-implicit=\"yes\" raw=\"/&quot;Member Data&quot;\" section=\"Member Data\" type=\"pod\">\n\"Member Data\"\n</L>\n\nAs another example, this Pod source:\n\nL<the various attributes|/\"Member Data\">\n\nproduces this event structure:\n\n<L raw=\"the various attributes|/&quot;Member Data&quot;\" section=\"Member Data\" type=\"pod\">\nthe various attributes\n</L>\n\nIn cases of links to a section in a different Pod document, there are both a *section*\nattribute and a to attribute. For example, this Pod source:\n\nL<perlsyn/\"Basic BLOCKs and Switch Statements\">\n\nproduces this event structure:\n\n<L content-implicit=\"yes\" raw=\"perlsyn/&quot;Basic BLOCKs and Switch Statements&quot;\" section=\"Basic BLOCKs and Switch Statements\" to=\"perlsyn\" type=\"pod\">\n\"Basic BLOCKs and Switch Statements\" in perlsyn\n</L>\n\nAs another example, this Pod source:\n\nL<SWITCH statements|perlsyn/\"Basic BLOCKs and Switch Statements\">\n\nproduces this event structure:\n\n<L raw=\"SWITCH statements|perlsyn/&quot;Basic BLOCKs and Switch Statements&quot;\" section=\"Basic BLOCKs and Switch Statements\" to=\"perlsyn\" type=\"pod\">\nSWITCH statements\n</L>\n\nIncidentally, note that we do not distinguish between these syntaxes:\n\nL</\"Member Data\">\nL<\"Member Data\">\nL</Member Data>\nL<Member Data>    [deprecated syntax]\n\nThat is, they all produce the same event structure (for the most part), namely:\n\n<L content-implicit=\"yes\" raw=\"$dependsonsyntax\" section=\"Member Data\" type=\"pod\">\n&#34;Member Data&#34;\n</L>\n\nThe *raw* attribute depends on what the raw content of the \"L<>\" is, so that is why the\nevent structure is the same \"for the most part\".\n\nIf you have not guessed it yet, the *raw* attribute contains the raw, original, unescaped\ncontent of the \"L<>\" formatting code. In addition to the examples above, take notice of the\nfollowing event structure produced by the following \"L<>\" formatting code.\n\nL<click B<here>|page/About the C<-M> switch>\n\n<L raw=\"click B<here>|page/About the C<-M> switch\" section=\"About the -M switch\" to=\"page\" type=\"pod\">\nclick B<here>\n</L>\n\nSpecifically, notice that the formatting codes are present and unescaped in *raw*.\n\nThere is a known bug in the *raw* attribute where any surrounding whitespace is condensed\ninto a single ' '. For example, given L< link>, *raw* will be \" link\".\n\nevents with an elementname of E or Z\nWhile there are Pod codes E<...> and Z<>, these *do not* produce any E or Z events -- that\nis, there are no such events as E or Z.\n\nevents with an elementname of Verbatim\nWhen a Pod verbatim paragraph (AKA \"codeblock\") is parsed, it produces this event structure:\n\n<Verbatim startline=\"543\" xml:space=\"preserve\">\n...text...\n</Verbatim>\n\nThe value of the *startline* attribute will be the line number of the first line of this\nverbatim block. The *xml:space* attribute is always present, and always has the value\n\"preserve\".\n\nThe text content will have tabs already expanded.\n\nevents with an elementname of head1 .. head4\nWhen a \"=head1 ...\" directive is parsed, it produces this event structure:\n\n<head1>\n...stuff...\n</head1>\n\nFor example, a directive consisting of this:\n\n=head1 Options to C<new> et al.\n\nwill produce this event structure:\n\n<head1 startline=\"543\">\nOptions to\n<C>\nnew\n</C>\net al.\n</head1>\n\n\"=head2\" through \"=head4\" directives are the same, except for the element names in the event\nstructure.\n\nevents with an elementname of encoding\nIn the default case, the events corresponding to \"=encoding\" directives are not emitted.\nThey are emitted if \"keepencodingdirective\" is true. In that case they produce event\nstructures like \"events with an elementname of head1 .. head4\" above.\n\nevents with an elementname of over-bullet\nWhen an \"=over ... =back\" block is parsed where the items are a bulleted list, it will\nproduce this event structure:\n\n<over-bullet indent=\"4\" startline=\"543\">\n<item-bullet startline=\"545\">\n...Stuff...\n</item-bullet>\n...more item-bullets...\n</over-bullet fake-closer=\"1\">\n\nThe attribute *fake-closer* is only present if it is a true value; it is not present if it\nis a false value. It is shown in the above example to illustrate where the attribute is (in\nthe closing tag). It signifies that the \"=over\" did not have a matching \"=back\", and thus\nPod::Simple had to create a fake closer.\n\nFor example, this Pod source:\n\n=over\n\n=item *\n\nSomething\n\n=back\n\nWould produce an event structure that does not have the *fake-closer* attribute, whereas\nthis Pod source:\n\n=over\n\n=item *\n\nGasp! An unclosed =over block!\n\nwould. The rest of the over-* examples will not demonstrate this attribute, but they all can\nhave it. See Pod::Checker's source for an example of this attribute being used.\n\nThe value of the *indent* attribute is whatever value is after the \"=over\" directive, as in\n\"=over 8\". If no such value is specified in the directive, then the *indent* attribute has\nthe value \"4\".\n\nFor example, this Pod source:\n\n=over\n\n=item *\n\nStuff\n\n=item *\n\nBar I<baz>!\n\n=back\n\nproduces this event structure:\n\n<over-bullet indent=\"4\" startline=\"10\">\n<item-bullet startline=\"12\">\nStuff\n</item-bullet>\n<item-bullet startline=\"14\">\nBar <I>baz</I>!\n</item-bullet>\n</over-bullet>\n\nevents with an elementname of over-number\nWhen an \"=over ... =back\" block is parsed where the items are a numbered list, it will\nproduce this event structure:\n\n<over-number indent=\"4\" startline=\"543\">\n<item-number number=\"1\" startline=\"545\">\n...Stuff...\n</item-number>\n...more item-number...\n</over-bullet>\n\nThis is like the \"over-bullet\" event structure; but note that the contents are \"item-number\"\ninstead of \"item-bullet\", and note that they will have a \"number\" attribute, which some\nformatters/processors may ignore (since, for example, there's no need for it in HTML when\nproducing an \"<UL><LI>...</LI>...</UL>\" structure), but which any processor may use.\n\nNote that the values for the *number* attributes of \"item-number\" elements in a given\n\"over-number\" area *will* start at 1 and go up by one each time. If the Pod source doesn't\nfollow that order (even though it really should!), whatever numbers it has will be ignored\n(with the correct values being put in the *number* attributes), and an error message might\nbe issued to the user.\n\nevents with an elementname of over-text\nThese events are somewhat unlike the other over-* structures, as far as what their contents\nare. When an \"=over ... =back\" block is parsed where the items are a list of text\n\"subheadings\", it will produce this event structure:\n\n<over-text indent=\"4\" startline=\"543\">\n<item-text>\n...stuff...\n</item-text>\n...stuff (generally Para or Verbatim elements)...\n<item-text>\n...more item-text and/or stuff...\n</over-text>\n\nThe *indent* and *fake-closer* attributes are as with the other over-* events.\n\nFor example, this Pod source:\n\n=over\n\n=item Foo\n\nStuff\n\n=item Bar I<baz>!\n\nQuux\n\n=back\n\nproduces this event structure:\n\n<over-text indent=\"4\" startline=\"20\">\n<item-text startline=\"22\">\nFoo\n</item-text>\n<Para startline=\"24\">\nStuff\n</Para>\n<item-text startline=\"26\">\nBar\n<I>\nbaz\n</I>\n!\n</item-text>\n<Para startline=\"28\">\nQuux\n</Para>\n</over-text>\n\nevents with an elementname of over-block\nThese events are somewhat unlike the other over-* structures, as far as what their contents\nare. When an \"=over ... =back\" block is parsed where there are no items, it will produce\nthis event structure:\n\n<over-block indent=\"4\" startline=\"543\">\n...stuff (generally Para or Verbatim elements)...\n</over-block>\n\nThe *indent* and *fake-closer* attributes are as with the other over-* events.\n\nFor example, this Pod source:\n\n=over\n\nFor cutting off our trade with all parts of the world\n\nFor transporting us beyond seas to be tried for pretended offenses\n\nHe is at this time transporting large armies of foreign mercenaries to\ncomplete the works of death, desolation and tyranny, already begun with\ncircumstances of cruelty and perfidy scarcely paralleled in the most\nbarbarous ages, and totally unworthy the head of a civilized nation.\n\n=back\n\nwill produce this event structure:\n\n<over-block indent=\"4\" startline=\"2\">\n<Para startline=\"4\">\nFor cutting off our trade with all parts of the world\n</Para>\n<Para startline=\"6\">\nFor transporting us beyond seas to be tried for pretended offenses\n</Para>\n<Para startline=\"8\">\nHe is at this time transporting large armies of [...more text...]\n</Para>\n</over-block>\n\nevents with an elementname of over-empty\nNote: These events are only triggered if \"parseemptylists()\" is set to a true value.\n\nThese events are somewhat unlike the other over-* structures, as far as what their contents\nare. When an \"=over ... =back\" block is parsed where there is no content, it will produce\nthis event structure:\n\n<over-empty indent=\"4\" startline=\"543\">\n</over-empty>\n\nThe *indent* and *fake-closer* attributes are as with the other over-* events.\n\nFor example, this Pod source:\n\n=over\n\n=over\n\n=back\n\n=back\n\nwill produce this event structure:\n\n<over-block indent=\"4\" startline=\"1\">\n<over-empty indent=\"4\" startline=\"3\">\n</over-empty>\n</over-block>\n\nNote that the outer \"=over\" is a block because it has no \"=item\"s but still has content: the\ninner \"=over\". The inner \"=over\", in turn, is completely empty, and is treated as such.\n\nevents with an elementname of item-bullet\nSee \"events with an elementname of over-bullet\", above.\n\nevents with an elementname of item-number\nSee \"events with an elementname of over-number\", above.\n\nevents with an elementname of item-text\nSee \"events with an elementname of over-text\", above.\n\nevents with an elementname of for\nTODO...\n\nevents with an elementname of Data\nTODO...\n\n### More Pod::Simple Methods\n\nPod::Simple provides a lot of methods that aren't generally interesting to the end user of an\nexisting Pod formatter, but some of which you might find useful in writing a Pod formatter. They\nare listed below. The first several methods (the accept* methods) are for declaring the\ncapabilities of your parser, notably what \"=for *targetname*\" sections it's interested in, what\nextra N<...> codes it accepts beyond the ones described in the *perlpod*.\n\n\"$parser->accepttargets( *SOMEVALUE* )\"\nAs the parser sees sections like:\n\n=for html  <img src=\"fig1.jpg\">\n\nor\n\n=begin html\n\n<img src=\"fig1.jpg\">\n\n=end html\n\n...the parser will ignore these sections unless your subclass has specified that it wants to\nsee sections targeted to \"html\" (or whatever the formatter name is).\n\nIf you want to process all sections, even if they're not targeted for you, call this before\nyou start parsing:\n\n$parser->accepttargets('*');\n\n\"$parser->accepttargetsastext( *SOMEVALUE* )\"\nThis is like accepttargets, except that it specifies also that the content of sections for\nthis target should be treated as Pod text even if the target name in \"=for *targetname*\"\ndoesn't start with a \":\".\n\nAt time of writing, I don't think you'll need to use this.\n\n\"$parser->acceptcodes( *Codename*, *Codename*... )\"\nThis tells the parser that you accept additional formatting codes, beyond just the standard\nones (I B C L F S X, plus the two weird ones you don't actually see in the parse tree, Z and\nE). For example, to also accept codes \"N\", \"R\", and \"W\":\n\n$parser->acceptcodes( qw( N R W ) );\n\nTODO: document how this interacts with =extend, and long element names\n\n\"$parser->acceptdirectiveasdata( *directivename* )\"\n\"$parser->acceptdirectiveasverbatim( *directivename* )\"\n\"$parser->acceptdirectiveasprocessed( *directivename* )\"\nIn the unlikely situation that you need to tell the parser that you will accept additional\ndirectives (\"=foo\" things), you need to first set the parser to treat its content as data\n(i.e., not really processed at all), or as verbatim (mostly just expanding tabs), or as\nprocessed text (parsing formatting codes like B<...>).\n\nFor example, to accept a new directive \"=method\", you'd presumably use:\n\n$parser->acceptdirectiveasprocessed(\"method\");\n\nso that you could have Pod lines like:\n\n=method I<$whatever> thing B<um>\n\nMaking up your own directives breaks compatibility with other Pod formatters, in a way that\nusing \"=for *target* ...\" lines doesn't; however, you may find this useful if you're making\na Pod superset format where you don't need to worry about compatibility.\n\n\"$parser->nbspforS( *BOOLEAN* );\"\nSetting this attribute to a true value (and by default it is false) will turn \"S<...>\"\nsequences into sequences of words separated by \"\\xA0\" (non-breaking space) characters. For\nexample, it will take this:\n\nI like S<Dutch apple pie>, don't you?\n\nand treat it as if it were:\n\nI like DutchE<nbsp>appleE<nbsp>pie, don't you?\n\nThis is handy for output formats that don't have anything quite like an \"S<...>\" code, but\nwhich do have a code for non-breaking space.\n\nThere is currently no method for going the other way; but I can probably provide one upon\nrequest.\n\n\"$parser->versionreport()\"\nThis returns a string reporting the $VERSION value from your module (and its classname) as\nwell as the $VERSION value of Pod::Simple. Note that perlpodspec requires output formats\n(wherever possible) to note this detail in a comment in the output format. For example, for\nsome kind of SGML output format:\n\nprint OUT \"<!-- \\n\", $parser->versionreport, \"\\n -->\";\n\n\"$parser->podparacount()\"\nThis returns the count of Pod paragraphs seen so far.\n\n\"$parser->linecount()\"\nThis is the current line number being parsed. But you might find the \"linenumber\" event\nattribute more accurate, when it is present.\n\n\"$parser->nixXcodes( *SOMEVALUE* )\"\nThis attribute, when set to a true value (and it is false by default) ignores any \"X<...>\"\nsequences in the document being parsed. Many formats don't actually use the content of these\ncodes, so have no reason to process them.\n\n\"$parser->keepencodingdirective( *SOMEVALUE* )\"\nThis attribute, when set to a true value (it is false by default) will keep \"=encoding\" and\nits content in the event structure. Most formats don't actually need to process the content\nof an \"=encoding\" directive, even when this directive sets the encoding and the processor\nmakes use of the encoding information. Indeed, it is possible to know the encoding without\nprocessing the directive content.\n\n\"$parser->mergetext( *SOMEVALUE* )\"\nThis attribute, when set to a true value (and it is false by default) makes sure that only\none event (or token, or node) will be created for any single contiguous sequence of text.\nFor example, consider this somewhat contrived example:\n\nI just LOVE Z<>hotE<32>apple pie!\n\nWhen that is parsed and events are about to be called on it, it may actually seem to be four\ndifferent text events, one right after another: one event for \"I just LOVE \", one for \"hot\",\none for \" \", and one for \"apple pie!\". But if you have mergetext on, then you're guaranteed\nthat it will be fired as one text event: \"I just LOVE hot apple pie!\".\n\n\"$parser->codehandler( *CODEREF* )\"\nThis specifies code that should be called when a code line is seen (i.e., a line outside of\nthe Pod). Normally this is undef, meaning that no code should be called. If you provide a\nroutine, it should start out like this:\n\nsub getcodeline {  # or whatever you'll call it\nmy($line, $linenumber, $parser) = @;\n...\n}\n\nNote, however, that sometimes the Pod events aren't processed in exactly the same order as\nthe code lines are -- i.e., if you have a file with Pod, then code, then more Pod, sometimes\nthe code will be processed (via whatever you have codehandler call) before the all of the\npreceding Pod has been processed.\n\n\"$parser->cuthandler( *CODEREF* )\"\nThis is just like the codehandler attribute, except that it's for \"=cut\" lines, not code\nlines. The same caveats apply. \"=cut\" lines are unlikely to be interesting, but this is\nincluded for completeness.\n\n\"$parser->podhandler( *CODEREF* )\"\nThis is just like the codehandler attribute, except that it's for \"=pod\" lines, not code\nlines. The same caveats apply. \"=pod\" lines are unlikely to be interesting, but this is\nincluded for completeness.\n\n\"$parser->whitelinehandler( *CODEREF* )\"\nThis is just like the codehandler attribute, except that it's for lines that are seemingly\nblank but have whitespace (\" \" and/or \"\\t\") on them, not code lines. The same caveats apply.\nThese lines are unlikely to be interesting, but this is included for completeness.\n\n\"$parser->whine( *linenumber*, *complaint string* )\"\nThis notes a problem in the Pod, which will be reported in the \"Pod Errors\" section of the\ndocument and/or sent to STDERR, depending on the values of the attributes \"nowhining\",\n\"noerratasection\", and \"complainstderr\".\n\n\"$parser->scream( *linenumber*, *complaint string* )\"\nThis notes an error like \"whine\" does, except that it is not suppressible with \"nowhining\".\nThis should be used only for very serious errors.\n\n\"$parser->sourcedead(1)\"\nThis aborts parsing of the current document, by switching on the flag that indicates that\nEOF has been seen. In particularly drastic cases, you might want to do this. It's rather\nnicer than just calling \"die\"!\n\n\"$parser->hidelinenumbers( *SOMEVALUE* )\"\nSome subclasses that indiscriminately dump event attributes (well, except for ones beginning\nwith \"~\") can use this object attribute for refraining to dump the \"startline\" attribute.\n\n\"$parser->nowhining( *SOMEVALUE* )\"\nThis attribute, if set to true, will suppress reports of non-fatal error messages. The\ndefault value is false, meaning that complaints *are* reported. How they get reported\ndepends on the values of the attributes \"noerratasection\" and \"complainstderr\".\n\n\"$parser->noerratasection( *SOMEVALUE* )\"\nThis attribute, if set to true, will suppress generation of an errata section. The default\nvalue is false -- i.e., an errata section will be generated.\n\n\"$parser->complainstderr( *SOMEVALUE* )\"\nThis attribute, if set to true will send complaints to STDERR. The default value is false --\ni.e., complaints do not go to STDERR.\n\n\"$parser->bareoutput( *SOMEVALUE* )\"\nSome formatter subclasses use this as a flag for whether output should have prologue and\nepilogue code omitted. For example, setting this to true for an HTML formatter class should\nomit the \"<html><head><title>...</title><body>...\" prologue and the \"</body></html>\"\nepilogue.\n\nIf you want to set this to true, you should probably also set \"nowhining\" or at least\n\"noerratasection\" to true.\n\n\"$parser->preservewhitespace( *SOMEVALUE* )\"\nIf you set this attribute to a true value, the parser will try to preserve whitespace in the\noutput. This means that such formatting conventions as two spaces after periods will be\npreserved by the parser. This is primarily useful for output formats that treat whitespace\nas significant (such as text or *roff, but not HTML).\n\n\"$parser->parseemptylists( *SOMEVALUE* )\"\nIf this attribute is set to true, the parser will not ignore empty \"=over\"/\"=back\" blocks.\nThe type of \"=over\" will be *empty*, documented above, \"events with an elementname of\nover-empty\".\n\n### SEE ALSO\n\nPod::Simple -- event-based Pod-parsing framework\n\nPod::Simple::Methody -- like Pod::Simple, but each sort of event calls its own method (like\n\"starthead3\")\n\nPod::Simple::PullParser -- a Pod-parsing framework like Pod::Simple, but with a token-stream\ninterface\n\nPod::Simple::SimpleTree -- a Pod-parsing framework like Pod::Simple, but with a tree interface\n\nPod::Simple::Checker -- a simple Pod::Simple subclass that reads documents, and then makes a\nplaintext report of any errors found in the document\n\nPod::Simple::DumpAsXML -- for dumping Pod documents as tidily indented XML, showing each event\non its own line\n\nPod::Simple::XMLOutStream -- dumps a Pod document as XML (without introducing extra whitespace\nas Pod::Simple::DumpAsXML does).\n\nPod::Simple::DumpAsText -- for dumping Pod documents as tidily indented text, showing each event\non its own line\n\nPod::Simple::LinkSection -- class for objects representing the values of the TODO and TODO\nattributes of L<...> elements\n\nPod::Escapes -- the module that Pod::Simple uses for evaluating E<...> content\n\nPod::Simple::Text -- a simple plaintext formatter for Pod\n\nPod::Simple::TextContent -- like Pod::Simple::Text, but makes no effort for indent or wrap the\ntext being formatted\n\nPod::Simple::HTML -- a simple HTML formatter for Pod\n\nperlpod\n\nperlpodspec\n\nperldoc\n\n### SUPPORT\n\nQuestions or discussion about POD and Pod::Simple should be sent to the pod-people@perl.org mail\nlist. Send an empty email to pod-people-subscribe@perl.org to subscribe.\n\nThis module is managed in an open GitHub repository, <https://github.com/perl-pod/pod-simple/>.\nFeel free to fork and contribute, or to clone <git://github.com/perl-pod/pod-simple.git> and\nsend patches!\n\nPatches against Pod::Simple are welcome. Please send bug reports to\n<bug-pod-simple@rt.cpan.org>.\n\n### COPYRIGHT AND DISCLAIMERS\n\nCopyright (c) 2002 Sean M. Burke.\n\nThis library is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n\nThis program is distributed in the hope that it will be useful, but without any warranty;\nwithout even the implied warranty of merchantability or fitness for a particular purpose.\n\n### AUTHOR\n\nPod::Simple was created by Sean M. Burke <sburke@cpan.org>. But don't bother him, he's retired.\n\nPod::Simple is maintained by:\n\n*   Allison Randal \"allison@perl.org\"\n\n*   Hans Dieter Pearcey \"hdp@cpan.org\"\n\n*   David E. Wheeler \"dwheeler@cpan.org\"\n\n"
        }
    ],
    "structuredContent": {
        "command": "Pod::Simple::Subclassing",
        "section": "",
        "mode": "perldoc",
        "summary": "Pod::Simple::Subclassing -- write a formatter as a Pod::Simple subclass",
        "synopsis": "package Pod::SomeFormatter;\nuse Pod::Simple;\n@ISA = qw(Pod::Simple);\n$VERSION = '1.01';\nuse strict;\nsub handleelementstart {\nmy($parser, $elementname, $attrhashr) = @;\n...\n}\nsub handleelementend {\nmy($parser, $elementname, $attrhashr) = @;\n# NOTE: $attrhashr is only present when $elementname is \"over\" or \"begin\"\n# The remaining code excerpts will mostly ignore this $attrhashr, as it is\n# mostly useless. It is documented where \"over-*\" and \"begin\" events are\n# documented.\n...\n}\nsub handletext {\nmy($parser, $text) = @;\n...\n}\n1;",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 26,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 43,
                "subsections": []
            },
            {
                "name": "Events",
                "lines": 558,
                "subsections": []
            },
            {
                "name": "More Pod::Simple Methods",
                "lines": 200,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 40,
                "subsections": []
            },
            {
                "name": "SUPPORT",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND DISCLAIMERS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 10,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Pod::Simple::Subclassing -- write a formatter as a Pod::Simple subclass\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "package Pod::SomeFormatter;\nuse Pod::Simple;\n@ISA = qw(Pod::Simple);\n$VERSION = '1.01';\nuse strict;\n\nsub handleelementstart {\nmy($parser, $elementname, $attrhashr) = @;\n...\n}\n\nsub handleelementend {\nmy($parser, $elementname, $attrhashr) = @;\n# NOTE: $attrhashr is only present when $elementname is \"over\" or \"begin\"\n# The remaining code excerpts will mostly ignore this $attrhashr, as it is\n# mostly useless. It is documented where \"over-*\" and \"begin\" events are\n# documented.\n...\n}\n\nsub handletext {\nmy($parser, $text) = @;\n...\n}\n1;\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This document is about using Pod::Simple to write a Pod processor, generally a Pod formatter. If\nyou just want to know about using an existing Pod formatter, instead see its documentation and\nsee also the docs in Pod::Simple.\n\nThe zeroeth step in writing a Pod formatter is to make sure that there isn't already a decent\none in CPAN. See <http://search.cpan.org/>, and run a search on the name of the format you want\nto render to. Also consider joining the Pod People list\n<http://lists.perl.org/showlist.cgi?name=pod-people> and asking whether anyone has a formatter\nfor that format -- maybe someone cobbled one together but just hasn't released it.\n\nThe first step in writing a Pod processor is to read perlpodspec, which contains information on\nwriting a Pod parser (which has been largely taken care of by Pod::Simple), but also a lot of\nrequirements and recommendations for writing a formatter.\n\nThe second step is to actually learn the format you're planning to format to -- or at least as\nmuch as you need to know to represent Pod, which probably isn't much.\n\nThe third step is to pick which of Pod::Simple's interfaces you want to use:\n\nPod::Simple\nThe basic Pod::Simple interface that uses \"handleelementstart()\", \"handleelementend()\"\nand \"handletext()\".\n\nPod::Simple::Methody\nThe Pod::Simple::Methody interface is event-based, similar to that of HTML::Parser or\nXML::Parser's \"Handlers\".\n\nPod::Simple::PullParser\nPod::Simple::PullParser provides a token-stream interface, sort of like HTML::TokeParser's\ninterface.\n\nPod::Simple::SimpleTree\nPod::Simple::SimpleTree provides a simple tree interface, rather like XML::Parser's \"Tree\"\ninterface. Users familiar with XML handling will be comfortable with this interface. Users\ninterested in outputting XML, should look into the modules that produce an XML\nrepresentation of the Pod stream, notably Pod::Simple::XMLOutStream; you can feed the output\nof such a class to whatever XML parsing system you are most at home with.\n\nThe last step is to write your code based on how the events (or tokens, or tree-nodes, or the\nXML, or however you're parsing) will map to constructs in the output format. Also be sure to\nconsider how to escape text nodes containing arbitrary text, and what to do with text nodes that\nrepresent preformatted text (from verbatim sections).\n",
                "subsections": []
            },
            "Events": {
                "content": "TODO intro... mention that events are supplied for implicits, like for missing >'s\n\nIn the following section, we use XML to represent the event structure associated with a\nparticular construct. That is, an opening tag represents the element start, the attributes of\nthat opening tag are the attributes given to the callback, and the closing tag represents the\nend element.\n\nThree callback methods must be supplied by a class extending Pod::Simple to receive the\ncorresponding event:\n\n\"$parser->handleelementstart( *elementname*, *attrhashref* )\"\n\"$parser->handleelementend( *elementname* )\"\n\"$parser->handletext( *textstring* )\"\n\nHere's the comprehensive list of values you can expect as *elementname* in your implementation\nof \"handleelementstart\" and \"handleelementend\"::\n\nevents with an elementname of Document\nParsing a document produces this event structure:\n\n<Document startline=\"543\">\n...all events...\n</Document>\n\nThe value of the *startline* attribute will be the line number of the first Pod directive\nin the document.\n\nIf there is no Pod in the given document, then the event structure will be this:\n\n<Document contentless=\"1\" startline=\"543\">\n</Document>\n\nIn that case, the value of the *startline* attribute will not be meaningful; under current\nimplementations, it will probably be the line number of the last line in the file.\n\nevents with an elementname of Para\nParsing a plain (non-verbatim, non-directive, non-data) paragraph in a Pod document produces\nthis event structure:\n\n<Para startline=\"543\">\n...all events in this paragraph...\n</Para>\n\nThe value of the *startline* attribute will be the line number of the start of the\nparagraph.\n\nFor example, parsing this paragraph of Pod:\n\nThe value of the I<startline> attribute will be the\nline number of the start of the paragraph.\n\nproduces this event structure:\n\n<Para startline=\"129\">\nThe value of the\n<I>\nstartline\n</I>\nattribute will be the line number of the first Pod directive\nin the document.\n</Para>\n\nevents with an elementname of B, C, F, or I.\nParsing a B<...> formatting code (or of course any of its semantically identical syntactic\nvariants B<< ... >>, or B<<<< ... >>>>, etc.) produces this event structure:\n\n<B>\n...stuff...\n</B>\n\nCurrently, there are no attributes conveyed.\n\nParsing C, F, or I codes produce the same structure, with only a different element name.\n\nIf your parser object has been set to accept other formatting codes, then they will be\npresented like these B/C/F/I codes -- i.e., without any attributes.\n\nevents with an elementname of S\nNormally, parsing an S<...> sequence produces this event structure, just as if it were a\nB/C/F/I code:\n\n<S>\n...stuff...\n</S>\n\nHowever, Pod::Simple (and presumably all derived parsers) offers the \"nbspforS\" option\nwhich, if enabled, will suppress all S events, and instead change all spaces in the content\nto non-breaking spaces. This is intended for formatters that output to a format that has no\ncode that means the same as S<...>, but which has a code/character that means non-breaking\nspace.\n\nevents with an elementname of X\nNormally, parsing an X<...> sequence produces this event structure, just as if it were a\nB/C/F/I code:\n\n<X>\n...stuff...\n</X>\n\nHowever, Pod::Simple (and presumably all derived parsers) offers the \"nixXcodes\" option\nwhich, if enabled, will suppress all X events and ignore their content. For\nformatters/processors that don't use X events, this is presumably quite useful.\n\nevents with an elementname of L\nBecause the L<...> is the most complex construct in the language, it should not surprise you\nthat the events it generates are the most complex in the language. Most of complexity is\nhidden away in the attribute values, so for those of you writing a Pod formatter that\nproduces a non-hypertextual format, you can just ignore the attributes and treat an L event\nstructure like a formatting element that (presumably) doesn't actually produce a change in\nformatting. That is, the content of the L event structure (as opposed to its attributes) is\nalways what text should be displayed.\n\nThere are, at first glance, three kinds of L links: URL, man, and pod.\n\nWhen a L<*someurl*> code is parsed, it produces this event structure:\n\n<L content-implicit=\"yes\" raw=\"thaturl\" to=\"thaturl\" type=\"url\">\nthaturl\n</L>\n\nThe \"type=\"url\"\" attribute is always specified for this type of L code.\n\nFor example, this Pod source:\n\nL<http://www.perl.com/CPAN/authors/>\n\nproduces this event structure:\n\n<L content-implicit=\"yes\" raw=\"http://www.perl.com/CPAN/authors/\" to=\"http://www.perl.com/CPAN/authors/\" type=\"url\">\nhttp://www.perl.com/CPAN/authors/\n</L>\n\nWhen a L<*manpage(section)*> code is parsed (and these are fairly rare and not terribly\nuseful), it produces this event structure:\n\n<L content-implicit=\"yes\" raw=\"manpage(section)\" to=\"manpage(section)\" type=\"man\">\nmanpage(section)\n</L>\n\nThe \"type=\"man\"\" attribute is always specified for this type of L code.\n\nFor example, this Pod source:\n\nL<crontab(5)>\n\nproduces this event structure:\n\n<L content-implicit=\"yes\" raw=\"crontab(5)\" to=\"crontab(5)\" type=\"man\">\ncrontab(5)\n</L>\n\nIn the rare cases where a man page link has a section specified, that text appears in a\n*section* attribute. For example, this Pod source:\n\nL<crontab(5)/\"ENVIRONMENT\">\n\nwill produce this event structure:\n\n<L content-implicit=\"yes\" raw=\"crontab(5)/&quot;ENVIRONMENT&quot;\" section=\"ENVIRONMENT\" to=\"crontab(5)\" type=\"man\">\n\"ENVIRONMENT\" in crontab(5)\n</L>\n\nIn the rare case where the Pod document has code like L<*sometext*|*manpage(section)*>, then\nthe *sometext* will appear as the content of the element, the *manpage(section)* text will\nappear only as the value of the *to* attribute, and there will be no\n\"content-implicit=\"yes\"\" attribute (whose presence means that the Pod parser had to infer\nwhat text should appear as the link text -- as opposed to cases where that attribute is\nabsent, which means that the Pod parser did *not* have to infer the link text, because that\nL code explicitly specified some link text.)\n\nFor example, this Pod source:\n\nL<hell itself!|crontab(5)>\n\nwill produce this event structure:\n\n<L raw=\"hell itself!|crontab(5)\" to=\"crontab(5)\" type=\"man\">\nhell itself!\n</L>\n\nThe last type of L structure is for links to/within Pod documents. It is the most complex\nbecause it can have a *to* attribute, *or* a *section* attribute, or both. The \"type=\"pod\"\"\nattribute is always specified for this type of L code.\n\nIn the most common case, the simple case of a L<podpage> code produces this event structure:\n\n<L content-implicit=\"yes\" raw=\"podpage\" to=\"podpage\" type=\"pod\">\npodpage\n</L>\n\nFor example, this Pod source:\n\nL<Net::Ping>\n\nproduces this event structure:\n\n<L content-implicit=\"yes\" raw=\"Net::Ping\" to=\"Net::Ping\" type=\"pod\">\nNet::Ping\n</L>\n\nIn cases where there is link-text explicitly specified, it is to be found in the content of\nthe element (and not the attributes), just as with the L<*sometext*|*manpage(section)*> case\ndiscussed above. For example, this Pod source:\n\nL<Perl Error Messages|perldiag>\n\nproduces this event structure:\n\n<L raw=\"Perl Error Messages|perldiag\" to=\"perldiag\" type=\"pod\">\nPerl Error Messages\n</L>\n\nIn cases of links to a section in the current Pod document, there is a *section* attribute\ninstead of a *to* attribute. For example, this Pod source:\n\nL</\"Member Data\">\n\nproduces this event structure:\n\n<L content-implicit=\"yes\" raw=\"/&quot;Member Data&quot;\" section=\"Member Data\" type=\"pod\">\n\"Member Data\"\n</L>\n\nAs another example, this Pod source:\n\nL<the various attributes|/\"Member Data\">\n\nproduces this event structure:\n\n<L raw=\"the various attributes|/&quot;Member Data&quot;\" section=\"Member Data\" type=\"pod\">\nthe various attributes\n</L>\n\nIn cases of links to a section in a different Pod document, there are both a *section*\nattribute and a to attribute. For example, this Pod source:\n\nL<perlsyn/\"Basic BLOCKs and Switch Statements\">\n\nproduces this event structure:\n\n<L content-implicit=\"yes\" raw=\"perlsyn/&quot;Basic BLOCKs and Switch Statements&quot;\" section=\"Basic BLOCKs and Switch Statements\" to=\"perlsyn\" type=\"pod\">\n\"Basic BLOCKs and Switch Statements\" in perlsyn\n</L>\n\nAs another example, this Pod source:\n\nL<SWITCH statements|perlsyn/\"Basic BLOCKs and Switch Statements\">\n\nproduces this event structure:\n\n<L raw=\"SWITCH statements|perlsyn/&quot;Basic BLOCKs and Switch Statements&quot;\" section=\"Basic BLOCKs and Switch Statements\" to=\"perlsyn\" type=\"pod\">\nSWITCH statements\n</L>\n\nIncidentally, note that we do not distinguish between these syntaxes:\n\nL</\"Member Data\">\nL<\"Member Data\">\nL</Member Data>\nL<Member Data>    [deprecated syntax]\n\nThat is, they all produce the same event structure (for the most part), namely:\n\n<L content-implicit=\"yes\" raw=\"$dependsonsyntax\" section=\"Member Data\" type=\"pod\">\n&#34;Member Data&#34;\n</L>\n\nThe *raw* attribute depends on what the raw content of the \"L<>\" is, so that is why the\nevent structure is the same \"for the most part\".\n\nIf you have not guessed it yet, the *raw* attribute contains the raw, original, unescaped\ncontent of the \"L<>\" formatting code. In addition to the examples above, take notice of the\nfollowing event structure produced by the following \"L<>\" formatting code.\n\nL<click B<here>|page/About the C<-M> switch>\n\n<L raw=\"click B<here>|page/About the C<-M> switch\" section=\"About the -M switch\" to=\"page\" type=\"pod\">\nclick B<here>\n</L>\n\nSpecifically, notice that the formatting codes are present and unescaped in *raw*.\n\nThere is a known bug in the *raw* attribute where any surrounding whitespace is condensed\ninto a single ' '. For example, given L< link>, *raw* will be \" link\".\n\nevents with an elementname of E or Z\nWhile there are Pod codes E<...> and Z<>, these *do not* produce any E or Z events -- that\nis, there are no such events as E or Z.\n\nevents with an elementname of Verbatim\nWhen a Pod verbatim paragraph (AKA \"codeblock\") is parsed, it produces this event structure:\n\n<Verbatim startline=\"543\" xml:space=\"preserve\">\n...text...\n</Verbatim>\n\nThe value of the *startline* attribute will be the line number of the first line of this\nverbatim block. The *xml:space* attribute is always present, and always has the value\n\"preserve\".\n\nThe text content will have tabs already expanded.\n\nevents with an elementname of head1 .. head4\nWhen a \"=head1 ...\" directive is parsed, it produces this event structure:\n\n<head1>\n...stuff...\n</head1>\n\nFor example, a directive consisting of this:\n\n=head1 Options to C<new> et al.\n\nwill produce this event structure:\n\n<head1 startline=\"543\">\nOptions to\n<C>\nnew\n</C>\net al.\n</head1>\n\n\"=head2\" through \"=head4\" directives are the same, except for the element names in the event\nstructure.\n\nevents with an elementname of encoding\nIn the default case, the events corresponding to \"=encoding\" directives are not emitted.\nThey are emitted if \"keepencodingdirective\" is true. In that case they produce event\nstructures like \"events with an elementname of head1 .. head4\" above.\n\nevents with an elementname of over-bullet\nWhen an \"=over ... =back\" block is parsed where the items are a bulleted list, it will\nproduce this event structure:\n\n<over-bullet indent=\"4\" startline=\"543\">\n<item-bullet startline=\"545\">\n...Stuff...\n</item-bullet>\n...more item-bullets...\n</over-bullet fake-closer=\"1\">\n\nThe attribute *fake-closer* is only present if it is a true value; it is not present if it\nis a false value. It is shown in the above example to illustrate where the attribute is (in\nthe closing tag). It signifies that the \"=over\" did not have a matching \"=back\", and thus\nPod::Simple had to create a fake closer.\n\nFor example, this Pod source:\n\n=over\n\n=item *\n\nSomething\n\n=back\n\nWould produce an event structure that does not have the *fake-closer* attribute, whereas\nthis Pod source:\n\n=over\n\n=item *\n\nGasp! An unclosed =over block!\n\nwould. The rest of the over-* examples will not demonstrate this attribute, but they all can\nhave it. See Pod::Checker's source for an example of this attribute being used.\n\nThe value of the *indent* attribute is whatever value is after the \"=over\" directive, as in\n\"=over 8\". If no such value is specified in the directive, then the *indent* attribute has\nthe value \"4\".\n\nFor example, this Pod source:\n\n=over\n\n=item *\n\nStuff\n\n=item *\n\nBar I<baz>!\n\n=back\n\nproduces this event structure:\n\n<over-bullet indent=\"4\" startline=\"10\">\n<item-bullet startline=\"12\">\nStuff\n</item-bullet>\n<item-bullet startline=\"14\">\nBar <I>baz</I>!\n</item-bullet>\n</over-bullet>\n\nevents with an elementname of over-number\nWhen an \"=over ... =back\" block is parsed where the items are a numbered list, it will\nproduce this event structure:\n\n<over-number indent=\"4\" startline=\"543\">\n<item-number number=\"1\" startline=\"545\">\n...Stuff...\n</item-number>\n...more item-number...\n</over-bullet>\n\nThis is like the \"over-bullet\" event structure; but note that the contents are \"item-number\"\ninstead of \"item-bullet\", and note that they will have a \"number\" attribute, which some\nformatters/processors may ignore (since, for example, there's no need for it in HTML when\nproducing an \"<UL><LI>...</LI>...</UL>\" structure), but which any processor may use.\n\nNote that the values for the *number* attributes of \"item-number\" elements in a given\n\"over-number\" area *will* start at 1 and go up by one each time. If the Pod source doesn't\nfollow that order (even though it really should!), whatever numbers it has will be ignored\n(with the correct values being put in the *number* attributes), and an error message might\nbe issued to the user.\n\nevents with an elementname of over-text\nThese events are somewhat unlike the other over-* structures, as far as what their contents\nare. When an \"=over ... =back\" block is parsed where the items are a list of text\n\"subheadings\", it will produce this event structure:\n\n<over-text indent=\"4\" startline=\"543\">\n<item-text>\n...stuff...\n</item-text>\n...stuff (generally Para or Verbatim elements)...\n<item-text>\n...more item-text and/or stuff...\n</over-text>\n\nThe *indent* and *fake-closer* attributes are as with the other over-* events.\n\nFor example, this Pod source:\n\n=over\n\n=item Foo\n\nStuff\n\n=item Bar I<baz>!\n\nQuux\n\n=back\n\nproduces this event structure:\n\n<over-text indent=\"4\" startline=\"20\">\n<item-text startline=\"22\">\nFoo\n</item-text>\n<Para startline=\"24\">\nStuff\n</Para>\n<item-text startline=\"26\">\nBar\n<I>\nbaz\n</I>\n!\n</item-text>\n<Para startline=\"28\">\nQuux\n</Para>\n</over-text>\n\nevents with an elementname of over-block\nThese events are somewhat unlike the other over-* structures, as far as what their contents\nare. When an \"=over ... =back\" block is parsed where there are no items, it will produce\nthis event structure:\n\n<over-block indent=\"4\" startline=\"543\">\n...stuff (generally Para or Verbatim elements)...\n</over-block>\n\nThe *indent* and *fake-closer* attributes are as with the other over-* events.\n\nFor example, this Pod source:\n\n=over\n\nFor cutting off our trade with all parts of the world\n\nFor transporting us beyond seas to be tried for pretended offenses\n\nHe is at this time transporting large armies of foreign mercenaries to\ncomplete the works of death, desolation and tyranny, already begun with\ncircumstances of cruelty and perfidy scarcely paralleled in the most\nbarbarous ages, and totally unworthy the head of a civilized nation.\n\n=back\n\nwill produce this event structure:\n\n<over-block indent=\"4\" startline=\"2\">\n<Para startline=\"4\">\nFor cutting off our trade with all parts of the world\n</Para>\n<Para startline=\"6\">\nFor transporting us beyond seas to be tried for pretended offenses\n</Para>\n<Para startline=\"8\">\nHe is at this time transporting large armies of [...more text...]\n</Para>\n</over-block>\n\nevents with an elementname of over-empty\nNote: These events are only triggered if \"parseemptylists()\" is set to a true value.\n\nThese events are somewhat unlike the other over-* structures, as far as what their contents\nare. When an \"=over ... =back\" block is parsed where there is no content, it will produce\nthis event structure:\n\n<over-empty indent=\"4\" startline=\"543\">\n</over-empty>\n\nThe *indent* and *fake-closer* attributes are as with the other over-* events.\n\nFor example, this Pod source:\n\n=over\n\n=over\n\n=back\n\n=back\n\nwill produce this event structure:\n\n<over-block indent=\"4\" startline=\"1\">\n<over-empty indent=\"4\" startline=\"3\">\n</over-empty>\n</over-block>\n\nNote that the outer \"=over\" is a block because it has no \"=item\"s but still has content: the\ninner \"=over\". The inner \"=over\", in turn, is completely empty, and is treated as such.\n\nevents with an elementname of item-bullet\nSee \"events with an elementname of over-bullet\", above.\n\nevents with an elementname of item-number\nSee \"events with an elementname of over-number\", above.\n\nevents with an elementname of item-text\nSee \"events with an elementname of over-text\", above.\n\nevents with an elementname of for\nTODO...\n\nevents with an elementname of Data\nTODO...\n",
                "subsections": []
            },
            "More Pod::Simple Methods": {
                "content": "Pod::Simple provides a lot of methods that aren't generally interesting to the end user of an\nexisting Pod formatter, but some of which you might find useful in writing a Pod formatter. They\nare listed below. The first several methods (the accept* methods) are for declaring the\ncapabilities of your parser, notably what \"=for *targetname*\" sections it's interested in, what\nextra N<...> codes it accepts beyond the ones described in the *perlpod*.\n\n\"$parser->accepttargets( *SOMEVALUE* )\"\nAs the parser sees sections like:\n\n=for html  <img src=\"fig1.jpg\">\n\nor\n\n=begin html\n\n<img src=\"fig1.jpg\">\n\n=end html\n\n...the parser will ignore these sections unless your subclass has specified that it wants to\nsee sections targeted to \"html\" (or whatever the formatter name is).\n\nIf you want to process all sections, even if they're not targeted for you, call this before\nyou start parsing:\n\n$parser->accepttargets('*');\n\n\"$parser->accepttargetsastext( *SOMEVALUE* )\"\nThis is like accepttargets, except that it specifies also that the content of sections for\nthis target should be treated as Pod text even if the target name in \"=for *targetname*\"\ndoesn't start with a \":\".\n\nAt time of writing, I don't think you'll need to use this.\n\n\"$parser->acceptcodes( *Codename*, *Codename*... )\"\nThis tells the parser that you accept additional formatting codes, beyond just the standard\nones (I B C L F S X, plus the two weird ones you don't actually see in the parse tree, Z and\nE). For example, to also accept codes \"N\", \"R\", and \"W\":\n\n$parser->acceptcodes( qw( N R W ) );\n\nTODO: document how this interacts with =extend, and long element names\n\n\"$parser->acceptdirectiveasdata( *directivename* )\"\n\"$parser->acceptdirectiveasverbatim( *directivename* )\"\n\"$parser->acceptdirectiveasprocessed( *directivename* )\"\nIn the unlikely situation that you need to tell the parser that you will accept additional\ndirectives (\"=foo\" things), you need to first set the parser to treat its content as data\n(i.e., not really processed at all), or as verbatim (mostly just expanding tabs), or as\nprocessed text (parsing formatting codes like B<...>).\n\nFor example, to accept a new directive \"=method\", you'd presumably use:\n\n$parser->acceptdirectiveasprocessed(\"method\");\n\nso that you could have Pod lines like:\n\n=method I<$whatever> thing B<um>\n\nMaking up your own directives breaks compatibility with other Pod formatters, in a way that\nusing \"=for *target* ...\" lines doesn't; however, you may find this useful if you're making\na Pod superset format where you don't need to worry about compatibility.\n\n\"$parser->nbspforS( *BOOLEAN* );\"\nSetting this attribute to a true value (and by default it is false) will turn \"S<...>\"\nsequences into sequences of words separated by \"\\xA0\" (non-breaking space) characters. For\nexample, it will take this:\n\nI like S<Dutch apple pie>, don't you?\n\nand treat it as if it were:\n\nI like DutchE<nbsp>appleE<nbsp>pie, don't you?\n\nThis is handy for output formats that don't have anything quite like an \"S<...>\" code, but\nwhich do have a code for non-breaking space.\n\nThere is currently no method for going the other way; but I can probably provide one upon\nrequest.\n\n\"$parser->versionreport()\"\nThis returns a string reporting the $VERSION value from your module (and its classname) as\nwell as the $VERSION value of Pod::Simple. Note that perlpodspec requires output formats\n(wherever possible) to note this detail in a comment in the output format. For example, for\nsome kind of SGML output format:\n\nprint OUT \"<!-- \\n\", $parser->versionreport, \"\\n -->\";\n\n\"$parser->podparacount()\"\nThis returns the count of Pod paragraphs seen so far.\n\n\"$parser->linecount()\"\nThis is the current line number being parsed. But you might find the \"linenumber\" event\nattribute more accurate, when it is present.\n\n\"$parser->nixXcodes( *SOMEVALUE* )\"\nThis attribute, when set to a true value (and it is false by default) ignores any \"X<...>\"\nsequences in the document being parsed. Many formats don't actually use the content of these\ncodes, so have no reason to process them.\n\n\"$parser->keepencodingdirective( *SOMEVALUE* )\"\nThis attribute, when set to a true value (it is false by default) will keep \"=encoding\" and\nits content in the event structure. Most formats don't actually need to process the content\nof an \"=encoding\" directive, even when this directive sets the encoding and the processor\nmakes use of the encoding information. Indeed, it is possible to know the encoding without\nprocessing the directive content.\n\n\"$parser->mergetext( *SOMEVALUE* )\"\nThis attribute, when set to a true value (and it is false by default) makes sure that only\none event (or token, or node) will be created for any single contiguous sequence of text.\nFor example, consider this somewhat contrived example:\n\nI just LOVE Z<>hotE<32>apple pie!\n\nWhen that is parsed and events are about to be called on it, it may actually seem to be four\ndifferent text events, one right after another: one event for \"I just LOVE \", one for \"hot\",\none for \" \", and one for \"apple pie!\". But if you have mergetext on, then you're guaranteed\nthat it will be fired as one text event: \"I just LOVE hot apple pie!\".\n\n\"$parser->codehandler( *CODEREF* )\"\nThis specifies code that should be called when a code line is seen (i.e., a line outside of\nthe Pod). Normally this is undef, meaning that no code should be called. If you provide a\nroutine, it should start out like this:\n\nsub getcodeline {  # or whatever you'll call it\nmy($line, $linenumber, $parser) = @;\n...\n}\n\nNote, however, that sometimes the Pod events aren't processed in exactly the same order as\nthe code lines are -- i.e., if you have a file with Pod, then code, then more Pod, sometimes\nthe code will be processed (via whatever you have codehandler call) before the all of the\npreceding Pod has been processed.\n\n\"$parser->cuthandler( *CODEREF* )\"\nThis is just like the codehandler attribute, except that it's for \"=cut\" lines, not code\nlines. The same caveats apply. \"=cut\" lines are unlikely to be interesting, but this is\nincluded for completeness.\n\n\"$parser->podhandler( *CODEREF* )\"\nThis is just like the codehandler attribute, except that it's for \"=pod\" lines, not code\nlines. The same caveats apply. \"=pod\" lines are unlikely to be interesting, but this is\nincluded for completeness.\n\n\"$parser->whitelinehandler( *CODEREF* )\"\nThis is just like the codehandler attribute, except that it's for lines that are seemingly\nblank but have whitespace (\" \" and/or \"\\t\") on them, not code lines. The same caveats apply.\nThese lines are unlikely to be interesting, but this is included for completeness.\n\n\"$parser->whine( *linenumber*, *complaint string* )\"\nThis notes a problem in the Pod, which will be reported in the \"Pod Errors\" section of the\ndocument and/or sent to STDERR, depending on the values of the attributes \"nowhining\",\n\"noerratasection\", and \"complainstderr\".\n\n\"$parser->scream( *linenumber*, *complaint string* )\"\nThis notes an error like \"whine\" does, except that it is not suppressible with \"nowhining\".\nThis should be used only for very serious errors.\n\n\"$parser->sourcedead(1)\"\nThis aborts parsing of the current document, by switching on the flag that indicates that\nEOF has been seen. In particularly drastic cases, you might want to do this. It's rather\nnicer than just calling \"die\"!\n\n\"$parser->hidelinenumbers( *SOMEVALUE* )\"\nSome subclasses that indiscriminately dump event attributes (well, except for ones beginning\nwith \"~\") can use this object attribute for refraining to dump the \"startline\" attribute.\n\n\"$parser->nowhining( *SOMEVALUE* )\"\nThis attribute, if set to true, will suppress reports of non-fatal error messages. The\ndefault value is false, meaning that complaints *are* reported. How they get reported\ndepends on the values of the attributes \"noerratasection\" and \"complainstderr\".\n\n\"$parser->noerratasection( *SOMEVALUE* )\"\nThis attribute, if set to true, will suppress generation of an errata section. The default\nvalue is false -- i.e., an errata section will be generated.\n\n\"$parser->complainstderr( *SOMEVALUE* )\"\nThis attribute, if set to true will send complaints to STDERR. The default value is false --\ni.e., complaints do not go to STDERR.\n\n\"$parser->bareoutput( *SOMEVALUE* )\"\nSome formatter subclasses use this as a flag for whether output should have prologue and\nepilogue code omitted. For example, setting this to true for an HTML formatter class should\nomit the \"<html><head><title>...</title><body>...\" prologue and the \"</body></html>\"\nepilogue.\n\nIf you want to set this to true, you should probably also set \"nowhining\" or at least\n\"noerratasection\" to true.\n\n\"$parser->preservewhitespace( *SOMEVALUE* )\"\nIf you set this attribute to a true value, the parser will try to preserve whitespace in the\noutput. This means that such formatting conventions as two spaces after periods will be\npreserved by the parser. This is primarily useful for output formats that treat whitespace\nas significant (such as text or *roff, but not HTML).\n\n\"$parser->parseemptylists( *SOMEVALUE* )\"\nIf this attribute is set to true, the parser will not ignore empty \"=over\"/\"=back\" blocks.\nThe type of \"=over\" will be *empty*, documented above, \"events with an elementname of\nover-empty\".\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "Pod::Simple -- event-based Pod-parsing framework\n\nPod::Simple::Methody -- like Pod::Simple, but each sort of event calls its own method (like\n\"starthead3\")\n\nPod::Simple::PullParser -- a Pod-parsing framework like Pod::Simple, but with a token-stream\ninterface\n\nPod::Simple::SimpleTree -- a Pod-parsing framework like Pod::Simple, but with a tree interface\n\nPod::Simple::Checker -- a simple Pod::Simple subclass that reads documents, and then makes a\nplaintext report of any errors found in the document\n\nPod::Simple::DumpAsXML -- for dumping Pod documents as tidily indented XML, showing each event\non its own line\n\nPod::Simple::XMLOutStream -- dumps a Pod document as XML (without introducing extra whitespace\nas Pod::Simple::DumpAsXML does).\n\nPod::Simple::DumpAsText -- for dumping Pod documents as tidily indented text, showing each event\non its own line\n\nPod::Simple::LinkSection -- class for objects representing the values of the TODO and TODO\nattributes of L<...> elements\n\nPod::Escapes -- the module that Pod::Simple uses for evaluating E<...> content\n\nPod::Simple::Text -- a simple plaintext formatter for Pod\n\nPod::Simple::TextContent -- like Pod::Simple::Text, but makes no effort for indent or wrap the\ntext being formatted\n\nPod::Simple::HTML -- a simple HTML formatter for Pod\n\nperlpod\n\nperlpodspec\n\nperldoc\n",
                "subsections": []
            },
            "SUPPORT": {
                "content": "Questions or discussion about POD and Pod::Simple should be sent to the pod-people@perl.org mail\nlist. Send an empty email to pod-people-subscribe@perl.org to subscribe.\n\nThis module is managed in an open GitHub repository, <https://github.com/perl-pod/pod-simple/>.\nFeel free to fork and contribute, or to clone <git://github.com/perl-pod/pod-simple.git> and\nsend patches!\n\nPatches against Pod::Simple are welcome. Please send bug reports to\n<bug-pod-simple@rt.cpan.org>.\n",
                "subsections": []
            },
            "COPYRIGHT AND DISCLAIMERS": {
                "content": "Copyright (c) 2002 Sean M. Burke.\n\nThis library is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n\nThis program is distributed in the hope that it will be useful, but without any warranty;\nwithout even the implied warranty of merchantability or fitness for a particular purpose.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Pod::Simple was created by Sean M. Burke <sburke@cpan.org>. But don't bother him, he's retired.\n\nPod::Simple is maintained by:\n\n*   Allison Randal \"allison@perl.org\"\n\n*   Hans Dieter Pearcey \"hdp@cpan.org\"\n\n*   David E. Wheeler \"dwheeler@cpan.org\"\n",
                "subsections": []
            }
        }
    }
}