1Pod::Simple::SimpleTree(P3eprml)Programmers Reference GPuoidd:e:Simple::SimpleTree(3pm)
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 whather 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 http://github.com/theory/pod-simple/ <http://github.com/theory/pod-
81 simple/>. Feel free to fork and contribute, or to clone
82 git://github.com/theory/pod-simple.git <git://github.com/theory/pod-
83 simple.git> and send patches!
84
85 Patches against Pod::Simple are welcome. Please send bug reports to
86 <bug-pod-simple@rt.cpan.org>.
87
89 Copyright (c) 2002 Sean M. Burke.
90
91 This library is free software; you can redistribute it and/or modify it
92 under the same terms as Perl itself.
93
94 This program is distributed in the hope that it will be useful, but
95 without any warranty; without even the implied warranty of
96 merchantability or fitness for a particular purpose.
97
99 Pod::Simple was created by Sean M. Burke <sburke@cpan.org>. But don't
100 bother him, he's retired.
101
102 Pod::Simple is maintained by:
103
104 · Allison Randal "allison@perl.org"
105
106 · Hans Dieter Pearcey "hdp@cpan.org"
107
108 · David E. Wheeler "dwheeler@cpan.org"
109
110
111
112perl v5.12.4 2011-06-07 Pod::Simple::SimpleTree(3pm)