README

NAME

Pod::TreeWalker - Walk a Pod tree and generate an event for each node

SYNOPSIS

use Pod::TreeWalker;

my $to-html = Pod::To::HTML.new(...);
Pod::TreeWalker.new( :listener($to-html) ).walk-pod($=pod);

DESCRIPTION

This class provides an API for walking a pod tree (as provided by $=pod). Each node in the tree will trigger one or more events. These events cause methods to be called on a listener object that you provide. This lets you do something with a Pod document without having to know much about the underlying tree structure of Pod.

METHODS

new

my $walker = Pod::TreeWalker.new( :listener($object) )

The constructor expects a single named argument :listener. This object must implement the Pod::TreeWalker::Listener API.

walk-pod

$walker.walk-pod($pod);

This method walks through a pod tree starting with the top node in $pod. You can provide either an array of pod nodes (as stored in $=pod) or a single top-level node (such as $=pod[0]).

text-content-of

say $walker.text-contents-of($pod)

Given a Pod::Block of any sort, this method recursively descends the blocks contents and returns the concatenation of all the plain text that it finds.

AUTHOR

Dave Rolsky

COPYRIGHT AND LICENSE

Copyright 2015 - 2018 Dave Rolsky

Copyright 2019 - 2022 Raku Community

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.

Pod::TreeWalker v0.0.4

Walk a Pod tree and generate an event for each node

Authors

  • Dave Rolsky

License

Artistic-2.0

Dependencies

Test Dependencies

Provides

  • Pod::TreeWalker
  • Pod::TreeWalker::Listener

Documentation

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.