| Description | A static content generator. |

Newcomen::Catalog - Manages all source collections of the project.

use Newcomen::Catalog;
my $catalog = Newcomen::Catalog -> new ();
# Add a collection:
$catalog -> add ($collection);
# Get a collection:
my $collection = $catalog -> collection ($collection_id);
# Iterate over all collections:
for my $collection ($catalog -> collections ()) {
# ...
}
Newcomen::Catalog is a container for the source collections of the Newcomen project (see Newcomen::Collection). See the developer section in Newcomen::Manual for a description of how Newcomen works and how the catalog fits in.
Plugins may use Newcomen::Role::Attribute::Catalog to access the main catalog instance.

my $catalog = Newcomen::Catalog -> new ();
Constructor. No parameters, the collection list will be empty initially.

Newcomen::Catalog uses a hashref to store the collections, with the collection IDs as keys, and the collection instances as values. It uses the hash methods of Newcomen::Util::Traits, with the following exceptions and additions:
Please see Newcomen::Util::Traits for a complete list of methods and more details.
Toggle source: add
sub add {
my $self = shift;
my $coll = shift;
confess 'Collection ID not unique: ' . $coll -> id () if $self -> exists ($coll -> id ());
$self -> _set ($coll -> id (), $coll);
}$catalog -> add ($collection);
This method adds a collection (an Newcomen::Collection instance) to the catalog. The collection may then be accessed by its collection ID. The ID must be unique, trying to add a collection with an ID that already exists in the catalog will cause a fatal error.

Newcomen::Collection, Newcomen::Manual, Newcomen::Role::Attribute::Catalog, Newcomen::Util::Traits

This is version 2014052501.

Stefan Goebel - newcomen {at} subtype {dot} de

Copyright 2013-2014 Stefan Goebel.
This file is part of Newcomen.
Newcomen is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the license, or (at your option) any later version.
Newcomen is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Newcomen. If not, see <http://www.gnu.org/licenses/>.