Pod::S...assing(3perl)
π NAME π
okay so bestie, vibe check: this is Pod::Simple::Subclassing(3perl), from the Perl Programmers Reference Guide, and it's literally the manual for writing a formatter as a Pod::Simple subclass. That's the whole assignment. We're building a formatter. π¦
β¨ SYNOPSIS β¨
package Pod::SomeFormatter;
use Pod::Simple;
@ISA = qw(Pod::Simple);
$VERSION = '1.01';
use strict;
sub _handle_element_start {
my($parser, $element_name, $attr_hash_r) = @_;
...
}
sub _handle_element_end {
my($parser, $element_name, $attr_hash_r) = @_;
# NOTE: $attr_hash_r is only present when $element_name is "over" or "begin"
# The remaining code excerpts will mostly ignore this $attr_hash_r, as it is
# mostly useless. It is documented where "over-*" and "begin" events are
# documented.
...
}
sub _handle_text {
my($parser, $text) = @_;
...
}
1;
πΈ DESCRIPTION πΈ
So this whole document is about using Pod::Simple to write a Pod processor, which usually means a Pod formatter. If what you actually wanna know is how to use a formatter someone already made, then nope, this isn't the page for you β go read that formatter's own docs, and also the docs in Pod::Simple. π
The zeroeth step in writing a Pod formatter is to make sure there isn't already a decent one sitting on CPAN. Go hit up <https://metacpan.org/>, and run a search on the name of the format you want to render to. Also, highkey consider joining the Pod People list <https://lists.perl.org/showlist.cgi?name=pod-people> and asking whether anyone has a formatter for that format β maybe someone cobbled one together and just never released it. π
The first step in writing a Pod processor is to read perlpodspec. That one's got the info on writing a Pod parser (which Pod::Simple has largely taken care of for you), but also a lot of requirements and recommendations for writing a formatter. Don't skip it, fr fr.
The second step is to actually learn the format you're planning to format to β or at least as much as you need to know to represent Pod, which probably isn't much. π
The third step is to pick which of Pod::Simple's interfaces you want to use:
Pod::Simpleβ the basicPod::Simpleinterface, the one that uses_handle_element_start(),_handle_element_end()and_handle_text().Pod::Simple::Methodyβ thePod::Simple::Methodyinterface is event-based, similar to that ofHTML::ParserorXML::Parser's"Handlers".Pod::Simple::PullParserβPod::Simple::PullParserprovides a token-stream interface, sort of likeHTML::TokeParser's interface.Pod::Simple::SimpleTreeβPod::Simple::SimpleTreeprovides a simple tree interface, rather likeXML::Parser's"Tree"interface. If you're comfy with XML handling, you'll be comfy here. And if you're interested in outputting XML, you should look into the modules that produce an XML representation of the Pod stream β notablyPod::Simple::XMLOutStream. You can feed the output of such a class to whatever XML parsing system you are most at home with. π
The last step is to write your code based on how the events (or tokens, or tree-nodes, or the XML, or however you're parsing) will map to constructs in the output format. Also be sure to consider how to escape text nodes containing arbitrary text, and what to do with text nodes that represent preformatted text (from verbatim sections). That part's the sneaky one. π
π Events π
TODO intro... mention that events are supplied for implicits, like for missing >'s
In the following section, we use XML to represent the event structure associated with a particular construct. Like, an opening tag represents the element start, the attributes of that opening tag are the attributes given to the callback, and the closing tag represents the end element. Simple as. β¨
Three callback methods must be supplied by a class extending Pod::Simple to receive the corresponding event:
"$parser->_handle_element_start( element_name, attr_hashref )""$parser->_handle_element_end( element_name )""$parser->_handle_text( text_string )"
Here's the comprehensive list of values you can expect as element_name in your implementation of "_handle_element_start" and "_handle_element_end":: π«
π events with an element_name of Document
Parsing a document produces this event structure:
<Document start_line="543">
...all events...
</Document>
The value of the start_line attribute will be the line number of the first Pod directive in the document.
If there is no Pod in the given document, then the event structure will be this:
<Document contentless="1" start_line="543">
</Document>
In that case, the value of the start_line attribute will not be meaningful; under current implementations, it will probably be the line number of the last line in the file. π€·βοΈ
π events with an element_name of Para
Parsing a plain (non-verbatim, non-directive, non-data) paragraph in a Pod document produces this event structure:
<Para start_line="543">
...all events in this paragraph...
</Para>
The value of the start_line attribute will be the line number of the start of the paragraph.
For example, parsing this paragraph of Pod:
The value of the I<start_line> attribute will be the
line number of the start of the paragraph.
produces this event structure:
<Para start_line="129">
The value of the
<I>
start_line
</I>
attribute will be the line number of the first Pod directive
in the document.
</Para>
π ±οΈ events with an element_name of B, C, F, I, or U.
Parsing a B<...> formatting code (or of course any of its semantically identical syntactic variants B<< ... >>, or B<<<< ... >>>>, etc.) produces this event structure:
<B>
...stuff...
</B>
Currently, there are no attributes conveyed.
Parsing C, F, or I codes produce the same structure, with only a different element name.
If your parser object has been set to accept other formatting codes, then they will be presented like these B/C/F/I/U codes β i.e., without any attributes. π
π events with an element_name of S
Normally, parsing an S<...> sequence produces this event structure, just as if it were a B/C/F/I code:
<S>
...stuff...
</S>
However, Pod::Simple (and presumably all derived parsers) offers the "nbsp_for_S" option which, if enabled, will suppress all S events, and instead change all spaces in the content to non-breaking spaces. This is intended for formatters that output to a format that has no code that means the same as S<...>, but which has a code/character that means non-breaking space. π«Ά
π« events with an element_name of X
Normally, parsing an X<...> sequence produces this event structure, just as if it were a B/C/F/I/U code:
<X>
...stuff...
</X>
However, Pod::Simple (and presumably all derived parsers) offers the "nix_X_codes" option which, if enabled, will suppress all X events and ignore their content. For formatters/processors that don't use X events, this is presumably quite useful. π
π events with an element_name of L
Because the L<...> is the most complex construct in the language, it should not surprise you that the events it generates are the most complex in the language. Most of complexity is hidden away in the attribute values, so for those of you writing a Pod formatter that produces a non-hypertextual format, you can just ignore the attributes and treat an L event structure like a formatting element that (presumably) doesn't actually produce a change in formatting. That is, the content of the L event structure (as opposed to its attributes) is always what text should be displayed.
There are, at first glance, three kinds of L links: URL, man, and pod. π
When a L<some_url> code is parsed, it produces this event structure:
<L content-implicit="yes" raw="that_url" to="that_url" type="url">
that_url
</L>
The "type="url"" attribute is always specified for this type of L code.
For example, this Pod source:
L<http://www.perl.com/CPAN/authors/>
produces this event structure:
<L content-implicit="yes" raw="http://www.perl.com/CPAN/authors/" to="http://www.perl.com/CPAN/authors/" type="url">
http://www.perl.com/CPAN/authors/
</L>
When a L<manpage(section)> code is parsed (and these are fairly rare and not terribly useful), it produces this event structure:
<L content-implicit="yes" raw="manpage(section)" to="manpage(section)" type="man">
manpage(section)
</L>
The "type="man"" attribute is always specified for this type of L code.
For example, this Pod source:
L<crontab(5)>
produces this event structure:
<L content-implicit="yes" raw="crontab(5)" to="crontab(5)" type="man">
crontab(5)
</L>
In the rare cases where a man page link has a section specified, that text appears in a section attribute. For example, this Pod source:
L<crontab(5)/"ENVIRONMENT">
will produce this event structure:
<L content-implicit="yes" raw="crontab(5)/"ENVIRONMENT"" section="ENVIRONMENT" to="crontab(5)" type="man">
"ENVIRONMENT" in crontab(5)
</L>
In the rare case where the Pod document has code like L<sometext|manpage(section)>, then the sometext will appear as the content of the element, the manpage(section) text will appear only as the value of the to attribute, and there will be no "content-implicit="yes"" attribute (whose presence means that the Pod parser had to infer what text should appear as the link text β as opposed to cases where that attribute is absent, which means that the Pod parser did not have to infer the link text, because that L code explicitly specified some link text.)
For example, this Pod source:
L<hell itself!|crontab(5)>
will produce this event structure:
<L raw="hell itself!|crontab(5)" to="crontab(5)" type="man">
hell itself!
</L>
The last type of L structure is for links to/within Pod documents. It is the most complex because it can have a to attribute, or a section attribute, or both. The "type="pod"" attribute is always specified for this type of L code.
In the most common case, the simple case of a L<podpage> code produces this event structure:
so when a link is just a plain old pod page name β no text, no section, nothing β you get content-implicit="yes" and <purple>both raw and to are the same pod page name</purple>, plus <mint>type="pod". like this Pod source:
L<Net::Ping>
and it spits out this event structure:
<L content-implicit="yes" raw="Net::Ping" to="Net::Ping" type="pod">
Net::Ping
</L>
now when you do write link text explicitly, bestie, listen β that text lives in the content of the element, NOT in the attributes. same energy as the L<sometext|manpage(section)> situation we already talked about π
. like:
L<Perl Error Messages|perldiag>
gives you:
<L raw="Perl Error Messages|perldiag" to="perldiag" type="pod">
Perl Error Messages
</L>
and if you're linking to a section inside the current document, there's a section attribute instead of a to attribute. periodt. like:
L</"Member Data">
becomes:
<L content-implicit="yes" raw="/"Member Data"" section="Member Data" type="pod">
"Member Data"
</L>
and another one, because examples are iconic:
L<the various attributes|/"Member Data">
becomes:
<L raw="the various attributes|/"Member Data"" section="Member Data" type="pod">
the various attributes
</L>
but if you're linking to a section in a different pod document? then you get both a section attribute AND a to attribute. slay. for example:
L<perlsyn/"Basic BLOCKs and Switch Statements">
produces:
<L content-implicit="yes" raw="perlsyn/"Basic BLOCKs and Switch Statements"" section="Basic BLOCKs and Switch Statements" to="perlsyn" type="pod">
"Basic BLOCKs and Switch Statements" in perlsyn
</L>
and like, another one:
L<SWITCH statements|perlsyn/"Basic BLOCKs and Switch Statements">
produces:
<L raw="SWITCH statements|perlsyn/"Basic BLOCKs and Switch Statements"" section="Basic BLOCKs and Switch Statements" to="perlsyn" type="pod">
SWITCH statements
</L>
okay so a lil side note that actually matters: the parser does not distinguish between these four syntaxes:
L</"Member Data">
L<"Member Data">
L</Member Data>
L<Member Data> [deprecated syntax]
like, they all produce the same event structure (for the most part!!), namely:
<L content-implicit="yes" raw="$depends_on_syntax" section="Member Data" type="pod">
"Member Data"
</L>
and the reason it's only "for the most part" is that the raw attribute depends on the raw content of the L<>, so yeah, that's where they diverge. got it? got it. π
if you haven't figured it out yet: the raw attribute is the raw, original, unescaped content of the L<> formatting code. fr fr. and beyond all the examples above, peep this one β this L<> formatting code:
L<click B<here>|page/About the C<-M> switch>
produces:
<L raw="click B<here>|page/About the C<-M> switch" section="About the -M switch" to="page" type="pod">
click B<here>
</L>
notice specifically that the formatting codes are present and unescaped in raw. π
and there's a known bug in therawattribute: any surrounding whitespace gets condensed into a single' '. so like, givenL< link>,rawwill be" link".
events with an element_name of E or Z
okay so there ARE Pod codes E<...> and Z<>, right? but they produce no E or Z events. like, there are literally no such events as E or Z. that's the whole section. π
events with an element_name of Verbatim
when a Pod verbatim paragraph (AKA "codeblock", iykyk) gets parsed, it produces this event structure:
<Verbatim start_line="543" xml:space="preserve">
...text...
</Verbatim>
the start_line attribute's value is the line number of the first line of this verbatim block. and the xml:space attribute is always present and always has the value "preserve".
oh and the text content will have tabs already expanded. no tab shenanigans left over, bestie.
events with an element_name of head1 .. head4
when a =head1 ... directive gets parsed, it produces this event structure:
<head1>
...stuff...
</head1>
for example, a directive consisting of:
=head1 Options to C<new> et al.
will produce:
<head1 start_line="543">
Options to
<C>
new
</C>
et al.
</head1>
and =head2 through =head4 directives are exactly the same deal, except the element names in the event structure are different. that's it. π
events with an element_name of encoding
in the default case, the events corresponding to =encoding directives are not emitted. they only get emitted if keep_encoding_directive is true. and if that's the case, they produce event structures just like "events with an element_name of head1 .. head4" up above. β
events with an element_name of over-bullet
okay so when an =over ... =back block gets parsed and the items are a bulleted list, it produces:
<over-bullet indent="4" start_line="543">
<item-bullet start_line="545">
...Stuff...
</item-bullet>
...more item-bullets...
</over-bullet fake-closer="1">
about that fake-closer attribute: it's only present if it's a true value, and it's not present if it's a false value. it's shown in the example above just to illustrate where it lives (in the closing tag, bestie, look at the closing tag). what it means is that the =over didn't have a matching =back, so Pod::Simple had to create a fake closer. π
so like, this Pod source:
=over
=item *
Something
=back
would produce an event structure with no fake-closer attribute. whereas this one:
=over
=item *
Gasp! An unclosed =over block!
would. and just so you know, the rest of the over-* examples won't show this attribute, but they can all have it. if you want to see it actually being used, go look at Pod::Checker's source.
the indent attribute's value is whatever value comes after the =over directive, like in =over 8. and if no such value is specified in the directive, then indent has the value "4".
for example, this Pod source:
=over
=item *
Stuff
=item *
Bar I<baz>!
=back
produces:
<over-bullet indent="4" start_line="10">
<item-bullet start_line="12">
Stuff
</item-bullet>
<item-bullet start_line="14">
Bar <I>baz</I>!
</item-bullet>
</over-bullet>
events with an element_name of over-number
when an =over ... =back block gets parsed and the items are a numbered list, you get:
<over-number indent="4" start_line="543">
<item-number number="1" start_line="545">
...Stuff...
</item-number>
...more item-number...
</over-bullet>
(this is basically the over-bullet structure's sibling, but notice the contents are item-number instead of item-bullet, and notice they have a number attribute β which some formatters/processors might straight up ignore, since like, there's no need for it in HTML when you're producing an <UL><LI>...</LI>...</UL> structure, but any processor is free to use it. do with that what you will. β¨)
and here's the thing: the values for the number attributes of item-number elements in a given over-number area will start at 1 and go up by one each time. and if the Pod source doesn't follow that order (even though it really should!!), whatever numbers it has will be ignored β with the correct values being put into the number attributes instead β and an error message might get issued to the user. π
events with an element_name of over-text
these events are kinda unlike the other over-* structures, as far as what their contents are. when an =over ... =back block gets parsed and the items are a list of text "subheadings", it produces:
<over-text indent="4" start_line="543">
<item-text>
...stuff...
</item-text>
...stuff (generally Para or Verbatim elements)...
<item-text>
...more item-text and/or stuff...
</over-text>
the indent and fake-closer attributes work exactly as with the other over-* events. π«Ά
for example, this Pod source:
=over
=item Foo
Stuff
=item Bar I<baz>!
Quux
=back
produces:
<over-text indent="4" start_line="20">
<item-text start_line="22">
Foo
</item-text>
<Para start_line="24">
Stuff
</Para>
<item-text start_line="26">
Bar
<I>
baz
</I>
!
</item-text>
<Para start_line="28">
Quux
</Para>
</over-text>
events with an element_name of over-block
these events are also kinda unlike the other over-* structures, as far as what their contents are. when an =over ... =back block gets parsed where there are no items, it produces:
<over-block indent="4" start_line="543">
...stuff (generally Para or Verbatim elements)...
</over-block>
and yeah, indent and fake-closer are the same as with the other over-* events. π
for example, this Pod source:
=over
For cutting off our trade with all parts of the world
For transporting us beyond seas to be tried for pretended offenses
He is at this time transporting large armies of foreign mercenaries to
complete the works of death, desolation and tyranny, already begun with
circumstances of cruelty and perfidy scarcely paralleled in the most
barbarous ages, and totally unworthy the head of a civilized nation.
=back
will produce this event structure:
<over-block indent="4" start_line="2">
<Para start_line="4">
For cutting off our trade with all parts of the world
</Para>
<Para start_line="6">
For transporting us beyond seas to be tried for pretended offenses
</Para>
<Para start_line="8">
He is at this time transporting large armies of [...more text...]
</Para>
</over-block>
events with an element_name of over-empty π«₯
heads up bestie: these events only fire if parse_empty_lists() is set to a true value. no setting, no event. that's the deal. π
These ones are kinda the weird cousins of the other over-* structures, ngl β at least as far as what's actually inside them. When an =over ... =back block gets parsed and there's literally nothing in it, you get this event structure:
<over-empty indent="4" start_line="543">
</over-empty>
The indent and fake-closer attributes work exactly like they do for the other over-* events. no surprises there, periodt.
So like, for example, this Pod source:
=over
=over
=back
=back
will produce this event structure:
<over-block indent="4" start_line="1">
<over-empty indent="4" start_line="3">
</over-empty>
</over-block>
Now here's the little twist π β the outer =over is a block, not empty-empty, because it has no =items but it does have content: the inner =over. And that inner =over? completely empty. nothing. zero. so it gets treated as such. slay. β¨
events with an element_name of item-bullet
See "events with an element_name of over-bullet", above. β¬οΈ go look, bestie, it's all the same vibe.
events with an element_name of item-number
See "events with an element_name of over-number", above. β¬οΈ same deal, fr fr.
events with an element_name of item-text
See "events with an element_name of over-text", above. β¬οΈ yep, that one too. iykyk. π
events with an element_name of for
TODO... π
events with an element_name of Data
TODO... π
β¨ More Pod::Simple Methods β¨
Okay bestie, so Pod::Simple has a whole β¨secondβ¨ pile of methods that the average person using an existing Pod formatter will literally never care about β but if you're actually building a Pod formatter, some of these are gonna be your new obsession. π«Ά Full list below, no skips.
The first batch (all the accept_* ones) is about declaring what your parser can do: which =for targetname sections it actually wants to see, and which extra N<...> codes it'll accept on top of the ones spelled out in the perlpod.
$parser->accept_targets( SOMEVALUE )
So when the parser bumps into sections like this:
=for html <img src="fig1.jpg">
or this:
=begin html
<img src="fig1.jpg">
=end html
β¦it's just gonna ignore them, unless your subclass has said out loud that it wants sections targeted at html (or whatever the formatter name happens to be). π
Want to process every section, even the ones that aren't targeted at you? Call this before you start parsing:
$parser->accept_targets('*');
$parser->accept_targets_as_text( SOMEVALUE )
Basically accept_targets, but with a bonus β¨: it also says that the content of sections for this target should be treated as Pod text β even when the target name in =for targetname doesn't start with a ":".
At time of writing, I don't think you'll need to use this. π
$parser->accept_codes( Codename, Codename... )
This one tells the parser you accept extra formatting codes β beyond just the standard ones (I B C L F S U X, plus the two weird ones you don't actually see in the parse tree, Z and E). Wanna also accept the codes N, R, and W? Say it like this:
$parser->accept_codes( qw( N R W ) );
TODO: document how this interacts with =extend, and long element names. π
$parser->accept_directive_as_data( directive_name )
$parser->accept_directive_as_verbatim( directive_name )
$parser->accept_directive_as_processed( directive_name )
Okay so in the super unlikely case that you need to tell the parser you'll accept extra directives (you know, the =foo things), you gotta first set the parser to treat that directive's content in one of three ways: as data (i.e. not really processed at all), as verbatim (mostly just expanding tabs), or as processed text (parsing formatting codes like B<...>). Pick your fighter. π
Say you wanna accept a brand new directive =method β you'd presumably go:
$parser->accept_directive_as_processed("method");
so that you could have Pod lines like:
=method I<$whatever> thing B<um>
β οΈ Making up your own directives breaks compatibility with other Pod formatters, in a way that using =for target ... lines does not. That said, it might be useful if you're building a Pod superset format where compatibility isn't even on your radar. Live your truth, just know what you're doing. π
$parser->nbsp_for_S( BOOLEAN );
Set this attribute to a true value (it's false by default, natch) and it'll turn S<...> sequences into sequences of words separated by "\xA0" (non-breaking space) characters. So it'll take this:
I like S<Dutch apple pie>, don't you?
and treat it as if it were:
I like DutchE<nbsp>appleE<nbsp>pie, don't you?
Super handy for output formats that don't have anything quite like an S<...> code, but do have a code for non-breaking space. π
There is currently no method for going the other way β but I can probably provide one upon request. π
$parser->version_report()
This returns a string reporting the $VERSION value from your module (plus its classname) as well as the $VERSION value of Pod::Simple. Fun fact: perlpodspec requires output formats (wherever possible) to note this detail in a comment in the output. For example, for some kind of SGML output format:
print OUT "<!-- \n", $parser->version_report, "\n -->";
$parser->pod_para_count()
Returns the count of Pod paragraphs seen so far. Simple as that. π¦
$parser->line_count()
This is the current line number being parsed. But heads up β you might find the line_number event attribute more accurate, when it's present. π
$parser->nix_X_codes( SOMEVALUE )
Set this attribute to a true value (it's false by default) and it ignores any X<...> sequences in the document being parsed. Lots of formats don't actually use the content of these codes, so they've got zero reason to process them. π«
$parser->keep_encoding_directive( SOMEVALUE )
Set this to a true value (false by default) and it'll keep =encoding and its content in the event structure. Most formats don't actually need to process the content of an =encoding directive β even when that directive is the thing setting the encoding and the processor is making use of the encoding info. Like, it's totally possible to know the encoding without processing the directive content. Iconic foresight, honestly. β¨
$parser->merge_text( SOMEVALUE )
Set this attribute to a true value (false by default, you know the drill) and it makes sure only one event (or token, or node) gets created for any single contiguous sequence of text. Consider this slightly unhinged example:
I just LOVE Z<>hotE<32>apple pie!
When that gets parsed and events are about to be called on it, it may actually seem like four separate text events, one right after another: one event for "I just LOVE ", one for "hot", one for " ", and one for "apple pie!". But with merge_text on, you're guaranteed it fires as one single text event: "I just LOVE hot apple pie!". Chef's kiss. ππ
$parser->code_handler( CODE_REF )
This specifies code that should be called when a code line is seen β i.e., a line that lives outside of the Pod. Normally this is undef, meaning nothing gets called. If you do provide a routine, it should start out like this:
sub get_code_line { # or whatever you'll call it
my($line, $line_number, $parser) = @_;
...
}
β οΈ But note: sometimes the Pod events aren't processed in exactly the same order as the code lines are. Like, if you've got a file with Pod, then code, then more Pod β sometimes the code will be processed (via whatever you have code_handler call) before all of the preceding Pod has been processed. Order is not it, bestie. π
$parser->cut_handler( CODE_REF )
Just like the code_handler attribute, except it's for =cut lines, not code lines. Same caveats apply. =cut lines are unlikely to be interesting, but this is included for completeness. π
$parser->pod_handler( CODE_REF )
Just like the code_handler attribute, except it's for =pod lines, not code lines. Same caveats apply. =pod lines are unlikely to be interesting, but this is included for completeness. πΈ
$parser->whiteline_handler( CODE_REF )
Just like the code_handler attribute, except it's for lines that are seemingly blank but have whitespace (" " and/or "\t") sitting on them, not code lines. Same caveats apply. These lines are unlikely to be interesting, but this is included for completeness. π§
$parser->whine( linenumber, complaint string )
This notes a problem in the Pod β which will get reported in the "Pod Errors" section of the document and/or sent to STDERR, depending on the values of the attributes "no_whining", "no_errata_section", and "complain_stderr".
$parser->scream( linenumber, complaint string )
Notes an error just like "whine" does β EXCEPT it is not suppressible with "no_whining". β οΈ Use this only for very serious errors. Very demure, very mindful, very reserved for emergencies. π₯
$parser->source_dead(1)
This aborts parsing of the current document by switching on the flag that indicates EOF has been seen. In particularly drastic cases, you might wanna do this. It's rather nicer than just calling "die"! π«Ά
$parser->hide_line_numbers( SOMEVALUE )
Some subclasses that indiscriminately dump event attributes (wellβ¦ except for ones beginning with "~") can use this object attribute to refrain from dumping the "start_line" attribute. Shy kings. π
$parser->no_whining( SOMEVALUE )
This attribute, if set to true, suppresses reports of non-fatal error messages. Default is false β meaning complaints are reported. How they get reported depends on the values of the attributes "no_errata_section" and "complain_stderr".
$parser->no_errata_section( SOMEVALUE )
This attribute, if set to true, suppresses generation of an errata section. Default is false β i.e., an errata section will be generated.
$parser->complain_stderr( SOMEVALUE )
This attribute, if set to true, sends complaints to STDERR. Default is false β i.e., complaints do not go to STDERR.
$parser->bare_output( SOMEVALUE )
Some formatter subclasses use this as a flag for whether output should have its prologue and epilogue code omitted. For example, setting this to true for an HTML formatter class should omit the "<html><head><title>...</title><body>..." prologue and the "</body></html>" epilogue. Bare minimum, literally. π
If you want to set this to true, you should probably also set "no_whining" β or at least "no_errata_section" β to true.
$parser->preserve_whitespace( SOMEVALUE )
Set this attribute to a true value and the parser will try to preserve whitespace in the output. That means formatting conventions like two spaces after periods will be preserved by the parser. This is primarily useful for output formats that treat whitespace as significant β like text or *roff, but not HTML. β
$parser->parse_empty_lists( SOMEVALUE )
Set this attribute to true and the parser will not ignore empty "=over"/"=back" blocks. The type of "=over" will be empty β documented above β as "events with an element_name of over-empty". π
π SEE ALSO π
okay bestie, here's the whole friend group β every module that hangs out with Pod::Simple π
Pod::Simpleβ the event-based Pod-parsing framework itself. the main character, obviously. πPod::Simple::Methodyβ likePod::Simple, but each sort of event calls its own method (likestart_head3) β¨Pod::Simple::PullParserβ a Pod-parsing framework likePod::Simple, but with a token-stream interface πPod::Simple::SimpleTreeβ a Pod-parsing framework likePod::Simple, but with a tree interface π³Pod::Simple::Checkerβ a simplePod::Simplesubclass that reads documents, and then makes a plaintext report of any errors found in the document πPod::Simple::DumpAsXMLβ for dumping Pod documents as tidily indented XML, showing each event on its own line πPod::Simple::XMLOutStreamβ dumps a Pod document as XML (without introducing extra whitespace asPod::Simple::DumpAsXMLdoes). πͺPod::Simple::DumpAsTextβ for dumping Pod documents as tidily indented text, showing each event on its own line πPod::Simple::LinkSectionβ class for objects representing the values of theTODOandTODOattributes ofL<...>elements πPod::Escapesβ the module thatPod::Simpleuses for evaluatingE<...>content πPod::Simple::Textβ a simple plaintext formatter for Pod π¬Pod::Simple::TextContentβ likePod::Simple::Text, but makes no effort for indent or wrap the text being formatted πPod::Simple::HTMLβ a simple HTML formatter for Pod πperlpodperlpodspecperldoc
π«Ά SUPPORT π«Ά
got questions? wanna gossip about POD and Pod::Simple? send them to the pod-people@perl.org mail list, bestie π¬
and if you wanna subscribe, send an empty email to pod-people-subscribe@perl.org β literally just vibes, zero words needed π
this module is managed in an open GitHub repository, <https://github.com/perl-pod/pod-simple/>. feel free to fork and contribute, or to clone <https://github.com/perl-pod/pod-simple.git> and send patches! π§
patches against Pod::Simple are welcome. please send bug reports to <bug-pod-simple@rt.cpan.org>. π (not me being excited about bug reports but like, we love a fix π
)
π COPYRIGHT AND DISCLAIMERS π
Copyright (c) 2002 Sean M. Burke.
this library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
this program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. yeah, that's the legal bit β it's giving "we promise nothing" but in the most polite way possible π
π AUTHOR π
Pod::Simple was created by Sean M. Burke <sburke@cpan.org>. but don't bother him, he's retired. π
Pod::Simple is maintained by:
- Allison Randal
allison@perl.org - Hans Dieter Pearcey
hdp@cpan.org - David E. Wheeler
dwheeler@cpan.org
these three are carrying the whole thing on their backs, fr fr π
and that's the whole page, bestie!! π this one's from perl v5.44.0, dated 2026-10-17 β and it's a Pod::Simple man page, so you know it's iconic β¨ go forth and parse some Pod, you absolute legend ππ
π
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms