POD::SIMPLE::SIMPLETREE(3perl)

πŸ’– Pod::Simple::SimpleTree πŸ’–

okay bestie, you found it β€” this is the perl manual page for Pod::Simple::SimpleTree (it lives in section 3perl, the module pages, iykyk) and it is genuinely one of my faves because it does exactly one thing and does it adorably. it parses Pod into a simple parse tree. that's it. that's the whole vibe. ✨


🌸 NAME 🌸

Pod::Simple::SimpleTree β€” parse Pod into a simple parse tree πŸŽ€


✨ SYNOPSIS ✨

here's the whole thing, verbatim, because why would I mess with perfection:

% cat ptest.pod

=head1 PIE

I like B<pie>!

% perl -MPod::Simple::SimpleTree -MData::Dumper -e \
   "print Dumper(Pod::Simple::SimpleTree->new->parse_file(shift)->root)" \
   ptest.pod

$VAR1 = [
          'Document',
          { 'start_line' => 1 },
          [
            'head1',
            { 'start_line' => 1 },
            'PIE'
          ],
          [
            'Para',
            { 'start_line' => 3 },
            'I like ',
            [
              'B',
              {},
              'pie'
            ],
            '!'
          ]
        ];

like. it ate. πŸ’… a whole document reduced to nested arrayrefs and we're all better for it.


🌈 DESCRIPTION 🌈

so who is this for? this class is for the girlies who are writing a Pod processor/formatter. if that's not you, no worries, but that's the audience, fr fr.

what it does: it takes Pod and parses it, and hands you back a parse tree made just of arrayrefs, hashrefs, and strings. that's the entire material palette. no objects, no fancy wrappers, just refs and strings. immaculate.

this is a subclass of Pod::Simple and it inherits all its methods, so everything Pod::Simple can do? you got it. lowkey the best part.

it's inspired by XML::Parser's "Tree" parsing-style β€” though bestie, it does not use exactly the same LoL format. so don't go assuming they're twins. they're more like... cousins who dress similarly. πŸ‘‘


πŸ¦‹ METHODS πŸ¦‹

at the end of the parse, call $parser->root to get the tree's top node. that's your way in. main character access point, honestly. 🌟

πŸ’œ Tree Contents πŸ’œ

every element node in the parse tree is represented by an arrayref shaped like this:

[ elementname, \%attributes, ...subnodes... ]

check the example tree dump in the Synopsis, above, if you wanna see it in the wild. πŸ“

every text node in the tree is just a plain, simple (non-ref) string scalar. which means β€” and this is the trick, bestie β€” you can test ref($node) to see whether you're holding an element node or just a text node. one little ref() and you know exactly what you're dealing with. iconic. πŸ’–

and the top node in the tree is:

[ 'Document', \%attributes, ...subnodes... ]

so that's always your starting point. πŸŽ€


πŸ”₯ SEE ALSO πŸ”₯

  • Pod::Simple
  • perllol
  • The "Tree" subsubsection in XML::Parser

go read those, they're the lore. πŸ“š


🫢 SUPPORT 🫢

got questions? wanna discuss POD and Pod::Simple? send them to the pod-people@perl.org mail list. to subscribe, send an empty email to pod-people-subscribe@perl.org β€” that's it, just empty, no subject drama needed. πŸ“§

this module is managed in an open GitHub repository, <https://github.com/perl-pod/pod-simple/>. feel free to fork and contribute, or clone <https://github.com/perl-pod/pod-simple.git> and send patches! honestly a slay. 🧚

patches against Pod::Simple are welcome β€” always. please send bug reports to <bug-pod-simple@rt.cpan.org>. they want your bugs, bestie. πŸ’€


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 β€” no warranty of merchantability, no warranty of fitness for a particular purpose. so like, it's giving generous, not giving guarantees. πŸ’œ


🌸 AUTHOR 🌸

Pod::Simple was created by Sean M. Burke <sburke@cpan.org>. but bestie, don't bother him, he's retired. respect the retirement era. πŸ™ˆ

Pod::Simple is maintained by:

  • Allison Randal allison@perl.org
  • Hans Dieter Pearcey hdp@cpan.org
  • David E. Wheeler dwheeler@cpan.org

and that's the whole page, bestie β€” this ships as part of perl v5.44.0, dated 2026-10-17, and that's a wrap. go build something cute with it. πŸ’…βœ¨πŸŒˆ

πŸ“¦ 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