| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "Pod::Simple::SimpleTree 3perl" |
| 58 |
.TH Pod::Simple::SimpleTree 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide" |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
Pod::Simple::SimpleTree \-\- parse Pod into a simple parse tree |
| 65 |
.SH SYNOPSIS |
| 66 |
.IX Header "SYNOPSIS" |
| 67 |
.Vb 1 |
| 68 |
\& % cat ptest.pod |
| 69 |
\& |
| 70 |
\& =head1 PIE |
| 71 |
\& |
| 72 |
\& I like B<pie>! |
| 73 |
\& |
| 74 |
\& % perl \-MPod::Simple::SimpleTree \-MData::Dumper \-e \e |
| 75 |
\& "print Dumper(Pod::Simple::SimpleTree\->new\->parse_file(shift)\->root)" \e |
| 76 |
\& ptest.pod |
| 77 |
\& |
| 78 |
\& $VAR1 = [ |
| 79 |
\& \*(AqDocument\*(Aq, |
| 80 |
\& { \*(Aqstart_line\*(Aq => 1 }, |
| 81 |
\& [ |
| 82 |
\& \*(Aqhead1\*(Aq, |
| 83 |
\& { \*(Aqstart_line\*(Aq => 1 }, |
| 84 |
\& \*(AqPIE\*(Aq |
| 85 |
\& ], |
| 86 |
\& [ |
| 87 |
\& \*(AqPara\*(Aq, |
| 88 |
\& { \*(Aqstart_line\*(Aq => 3 }, |
| 89 |
\& \*(AqI like \*(Aq, |
| 90 |
\& [ |
| 91 |
\& \*(AqB\*(Aq, |
| 92 |
\& {}, |
| 93 |
\& \*(Aqpie\*(Aq |
| 94 |
\& ], |
| 95 |
\& \*(Aq!\*(Aq |
| 96 |
\& ] |
| 97 |
\& ]; |
| 98 |
.Ve |
| 99 |
.SH DESCRIPTION |
| 100 |
.IX Header "DESCRIPTION" |
| 101 |
This class is of interest to people writing a Pod processor/formatter. |
| 102 |
.PP |
| 103 |
This class takes Pod and parses it, returning a parse tree made just |
| 104 |
of arrayrefs, and hashrefs, and strings. |
| 105 |
.PP |
| 106 |
This is a subclass of Pod::Simple and inherits all its methods. |
| 107 |
.PP |
| 108 |
This class is inspired by XML::Parser's "Tree" parsing-style, although |
| 109 |
it doesn't use exactly the same LoL format. |
| 110 |
.SH METHODS |
| 111 |
.IX Header "METHODS" |
| 112 |
At the end of the parse, call \f(CW\*(C`$parser\->root\*(C'\fR to get the |
| 113 |
tree's top node. |
| 114 |
.SH "Tree Contents" |
| 115 |
.IX Header "Tree Contents" |
| 116 |
Every element node in the parse tree is represented by an arrayref of |
| 117 |
the form: \f(CW\*(C`[ \fR\f(CIelementname\fR\f(CW, \e%attributes, \fR\f(CI...subnodes...\fR\f(CW ]\*(C'\fR. |
| 118 |
See the example tree dump in the Synopsis, above. |
| 119 |
.PP |
| 120 |
Every text node in the tree is represented by a simple (non-ref) |
| 121 |
string scalar. So you can test \f(CWref($node)\fR to see whether you have |
| 122 |
an element node or just a text node. |
| 123 |
.PP |
| 124 |
The top node in the tree is \f(CW\*(C`[ \*(AqDocument\*(Aq, \e%attributes, |
| 125 |
\&\fR\f(CI...subnodes...\fR\f(CW ]\*(C'\fR |
| 126 |
.SH "SEE ALSO" |
| 127 |
.IX Header "SEE ALSO" |
| 128 |
Pod::Simple |
| 129 |
.PP |
| 130 |
perllol |
| 131 |
.PP |
| 132 |
The "Tree" subsubsection in XML::Parser |
| 133 |
.SH SUPPORT |
| 134 |
.IX Header "SUPPORT" |
| 135 |
Questions or discussion about POD and Pod::Simple should be sent to the |
| 136 |
pod\[email protected] mail list. Send an empty email to |
| 137 |
pod\-people\[email protected] to subscribe. |
| 138 |
.PP |
| 139 |
This module is managed in an open GitHub repository, |
| 140 |
<https://github.com/perl\-pod/pod\-simple/>. Feel free to fork and contribute, or |
| 141 |
to clone <https://github.com/perl\-pod/pod\-simple.git> and send patches! |
| 142 |
.PP |
| 143 |
Patches against Pod::Simple are welcome. Please send bug reports to |
| 144 |
<bug\-pod\[email protected]>. |
| 145 |
.SH "COPYRIGHT AND DISCLAIMERS" |
| 146 |
.IX Header "COPYRIGHT AND DISCLAIMERS" |
| 147 |
Copyright (c) 2002 Sean M. Burke. |
| 148 |
.PP |
| 149 |
This library is free software; you can redistribute it and/or modify it |
| 150 |
under the same terms as Perl itself. |
| 151 |
.PP |
| 152 |
This program is distributed in the hope that it will be useful, but |
| 153 |
without any warranty; without even the implied warranty of |
| 154 |
merchantability or fitness for a particular purpose. |
| 155 |
.SH AUTHOR |
| 156 |
.IX Header "AUTHOR" |
| 157 |
Pod::Simple was created by Sean M. Burke <[email protected]>. |
| 158 |
But don't bother him, he's retired. |
| 159 |
.PP |
| 160 |
Pod::Simple is maintained by: |
| 161 |
.IP \(bu 4 |
| 162 |
Allison Randal \f(CW\*(C`[email protected]\*(C'\fR |
| 163 |
.IP \(bu 4 |
| 164 |
Hans Dieter Pearcey \f(CW\*(C`[email protected]\*(C'\fR |
| 165 |
.IP \(bu 4 |
| 166 |
David E. Wheeler \f(CW\*(C`[email protected]\*(C'\fR |