Trek through a tree one character at a time.

Test

Also available on CPAN

Test cases can be seen at the end of file lib/Tree/Trek.pm. The test cases are run by the GitHub Action.

Create a trekkable tree and trek through it.

my $n = node;

$n->put("aa") ->data = "AA";
$n->put("ab") ->data = "AB";
$n->put("ba") ->data = "BA";
$n->put("bb") ->data = "BB";
$n->put("aaa")->data = "AAA";

is_deeply [map {[$_->key, $_->data]} $n->traverse],
 [["aa",  "AA"],
  ["aaa", "AAA"],
  ["ab",  "AB"],
  ["ba",  "BA"],
  ["bb",  "BB"]];

For documentation see: CPAN