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 whather you have an ele‐
62 ment 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 Copyright (c) 2002 Sean M. Burke. All rights reserved.
76
77 This library is free software; you can redistribute it and/or modify it
78 under the same terms as Perl itself.
79
80 This program is distributed in the hope that it will be useful, but
81 without any warranty; without even the implied warranty of mer‐
82 chantability or fitness for a particular purpose.
83
85 Sean M. Burke "sburke@cpan.org"
86
87
88
89perl v5.8.8 2003-11-02 Pod::Simple::SimpleTree(3)