Stas Bekman > DocSet-0.19 > DocSet::NavigateCache

Download:
DocSet-0.19.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

DocSet::NavigateCache - Navigate the DocSet's caches in a readonly mode

SYNOPSIS ^

  my $nav = DocSet::NavigateCache->new($cache_path, $id, $rel_path);

  # go through all nodes from left to right, and remember the sequence
  # number of the $nav node (from which we have started)
  my $iterator = $nav->first;
  my $seq = 0;
  my $counter = 0;
  my @meta = ();
  while ($iterator) {
     $seq = $counter if $iterator->id eq $nav->id;
     push @meta, $iterator->meta;
     $iterator = $iterator->next;
     $counter++;
  }
  # add index node's meta data
  push @meta, $nav->index_node;

  # prev object
  $prev  = $nav->prev;

  # get all the ancestry
  my @parents = ();
  $p = $nav->up;
  while ($p) {
      push @parents, $p;
      $p = $p->up;
  }

  # access the docsets of the child nodes
  $child_docset = $nav->down()

DESCRIPTION ^

DocSet::NavigateCache navigates the cache created by docset objects during their scan stage. Once the navigator handle is obtained, it's possible to move between the nodes of the same level, using the next() and prev() methods or going up one level using the up() method. the first() method returns the object of the first node on the same level. Each of these methods returns a new DocSet::NavigateCache object or undef if the object cannot be created.

This object can be used to retrieve node's meta data, its id and its index node's meta data.

Currently it is used in the templates for the internal navigation widgets creation. That's where you will find the examples of its use (e.g. tmpl/custom/html/menu_top_level and tmpl/custom/html/navbar_global).

As DocSet::NavigateCache reads cache files in, it caches them, since usually the same file is required many times in a few subsequent calls.

Note that DocSet::NavigateCache doesn't see any hidden objects stored in the cache.

METHODS

META: to be completed (see SYNOPSIS meanwhile)

AUTHORS ^

Stas Bekman <stas (at) stason.org>

syntax highlighting: