NAME

PFT::Map::Index - Resolve symbols in PFT Entries

SYNOPSIS

Explicit construction:

use PFT::Map::Index;

die unless $map->isa('PFT::Map');
my $index = PFT::Map::Index->new($map);

Using map property:

my $index = $map->index;

Resolution:

die unless $node->isa('PFT::Map::Node');
die unless $sym->isa('PFT::Text::Symbol');
$index->resolve($node, $sym);

DESCRIPTION

A PFT::Map::Index object handles the unique identifiers of content items mapped in a PFT::Map object. It can be used to resolve symbols of a PFT::Map::Node, or to query the map (e.g. the set of entries between date X and date Y)

Properties

map

Reference to the associated map

Methods

content_id

Given a PFT::Content::Base (or any subclass) object, returns a string uniquely identifying it across the site. E.g.:

my $id = $resolver->content_id($content);
my $id = $resolver->content_id($virtual_page, $hdr);
my $id = $resolver->content_id(undef, $hdr);

The header is optional for the first two forms: unless supplied it will be retrieved by the content. In the third form the content is not supplied, so the header is mandatory.

resolve

The function resolves a symbol retrieved from the text of a PFT::Map::Node. The returned value will be one of the following:

A node (i.e. a PFT::Map::Node instance);
A string (e.g. http://manpages.org);
The undef value (meaning: failed resolution).