1Pod::Simple::SimpleTreeU(s3e)r Contributed Perl DocumentaPtoido:n:Simple::SimpleTree(3)
2
3
4
6 Pod::Simple::SimpleTree -- parse Pod into a simple parse tree
7
9 % cat ptest.pod
10
11 =head1 PIE
12
13 I like B<pie>!
14
15 % perl -MPod::Simple::SimpleTree -MData::Dumper -e \
16 "print Dumper(Pod::Simple::SimpleTree->new->parse_file(shift)->root)" \
17 ptest.pod
18
19 $VAR1 = [
20 'Document',
21 { 'start_line' => 1 },
22 [
23 'head1',
24 { 'start_line' => 1 },
25 'PIE'
26 ],
27 [
28 'Para',
29 { 'start_line' => 3 },
30 'I like ',
31 [
32 'B',
33 {},
34 'pie'
35 ],
36 '!'
37 ]
38 ];
39
41 This class is of interest to people writing a Pod processor/formatter.
42
43 This class takes Pod and parses it, returning a parse tree made just of
44 arrayrefs, and hashrefs, and strings.
45
46 This is a subclass of Pod::Simple and inherits all its methods.
47
48 This class is inspired by XML::Parser's "Tree" parsing-style, although
49 it doesn't use exactly the same LoL format.
50
52 At the end of the parse, call "$parser->root" to get the tree's top
53 node.
54
56 Every element node in the parse tree is represented by an arrayref of
57 the form: "[ elementname, \%attributes, ...subnodes... ]". See the
58 example tree dump in the Synopsis, above.
59
60 Every text node in the tree is represented by a simple (non-ref) string
61 scalar. So you can test "ref($node)" to see whether you have an
62 element node or just a text node.
63
64 The top node in the tree is "[ 'Document', \%attributes, ...subnodes...
65 ]"
66
68 Pod::Simple
69
70 perllol
71
72 The "Tree" subsubsection in XML::Parser
73
75 Questions or discussion about POD and Pod::Simple should be sent to the
76 pod-people@perl.org mail list. Send an empty email to
77 pod-people-subscribe@perl.org to subscribe.
78
79 This module is managed in an open GitHub repository,
80 <https://github.com/perl-pod/pod-simple/>. Feel free to fork and
81 contribute, or to clone <git://github.com/perl-pod/pod-simple.git> and
82 send patches!
83
84 Patches against Pod::Simple are welcome. Please send bug reports to
85 <bug-pod-simple@rt.cpan.org>.
86
88 Copyright (c) 2002 Sean M. Burke.
89
90 This library is free software; you can redistribute it and/or modify it
91 under the same terms as Perl itself.
92
93 This program is distributed in the hope that it will be useful, but
94 without any warranty; without even the implied warranty of
95 merchantability or fitness for a particular purpose.
96
98 Pod::Simple was created by Sean M. Burke <sburke@cpan.org>. But don't
99 bother him, he's retired.
100
101 Pod::Simple is maintained by:
102
103 • Allison Randal "allison@perl.org"
104
105 • Hans Dieter Pearcey "hdp@cpan.org"
106
107 • David E. Wheeler "dwheeler@cpan.org"
108
109
110
111perl v5.32.1 2021-01-27 Pod::Simple::SimpleTree(3)