NAME

PFT::Map - Map of a PFT site

SYNOPSIS

my $tree = PFT::Content->new($basedir);
PFT::Map->new($tree);

DESCRIPTION

The map of a PFT site allows to navigate the site content.

This can be useful for compiling the site or determining properties of the site (e.g. dangling links, important pages…).

Properties

nodes

List of the nodes

ids

List of the mnemonic ids.

map $m->id_to_node($_), $m->ids

is equivalent to

$m->nodes
tree

The associated content tree

pages

List of page nodes

months

List of month nodes

tags

List of tag nodes

index

The PFT::Map::Index object associated to this map.

It handles the unique identifiers of content items and can be used to query the map.

dump

# TODO: move forward this description, as method

Dump of the nodes in a easy-to-display form, that is a list of dictionaries.

This method is used mainly or solely for testing.

Methods

node_of

Given a PFT::Content::Base (or any subclass) object, returns the associated node, or undef if such node does not exist.

id_to_node

Given a unique mnemonic id (as in PFT::Content::Node::id) returns the associated node, or undef if there is no such node.

blog_recent

Getter for the most recent blog nodes.

The number N can be provided as parameter, and defaults to 1 if not provided.

In list context returns the N + 1 most recent blog nodes, ordered by date, from most to least recent. Less than N nodes will be returned if N is greater than the number of available entries.

In scalar context returns the N-th to last entry. For N equal to zero the most recent entry is returned.

months_recent

Getter for the most recent month nodes.

The number N can be provided as parameter, and defaults to 1 if not provided.

In list context returns the N + 1 most recent month nodes, ordered by date, from most to least recent. Less than N nodes will be returned if N is greater than the number of available entries.

In scalar context returns the N-th to last entry. For N equal to zero the most recent entry is returned.