The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::Fluidinfo::Namespace - Fluidinfo namespaces

SYNOPSIS

 use Net::Fluidinfo::Namespace;

 # create
 $ns = Net::Fluidinfo::Namespace->new(
    fin         => $fin,
    description => $description,
    path        => $path
 );
 $ns->create;

 # get, optionally fetching descrition
 $ns = Net::Fluidinfo::Namespace->get($fin, $path, description => 1);
 $ns->parent;
 
 # update
 $ns->description($new_description);
 $ns->update;

 # delete
 $ns->delete;
 

DESCRIPTION

Net::Fluidinfo::Namespace models Fluidinfo namespaces.

USAGE

Inheritance

Net::Fluidinfo::Namespace is a subclass of Net::Fluidinfo::Base.

Roles

Net::Fluidinfo::Namespace consumes the roles Net::Fluidinfo::HasObject, and Net::Fluidinfo::HasPath.

Class methods

Net::Fluidinfo::Namespace->new(%attrs)

Constructs a new namespace. The constructor accepts these parameters:

fin (required)

An instance of Net::Fluidinfo.

description (optional)

A description of this namespace.

parent (optional, but dependent)

The namespace you want to put this namespace into. An instance of Net::Fluidinfo::Namespace representing an existing namespace in Fluidinfo.

name (optional, but dependent)

The name of the namespace, which is the rightmost segment of its path. The name of "fxn/perl" is "perl".

path (optional, but dependent)

The path of the namespace, for example "fxn/perl".

The description attribute is not required because Fluidinfo allows fetching namespaces without their description. It must be defined when creating or updating namespaces though.

The attributes parent, path, and name are mutually dependent. Ultimately namespace creation has to be able to send the path of the parent and the name of the namespace to Fluidinfo. So you can set parent and name, or just path.

This constructor is only useful for creating new namespaces in Fluidinfo. Existing namespaces are fetched with get.

Net::Fluidinfo::Namespace->get($fin, $path, %opts)

Retrieves the namespace with path $path from Fluidinfo. Options are:

description (optional, default false)

Tells get whether you want to fetch the description.

namespace_names (optional, default false)

Tells get whether you want to fetch the names of child namespaces.

tag_names (optional, default false)

Tells get whether you want to fetch the names of child tags.

Net::Fluidinfo provides a convenience shortcut for this method.

Instance Methods

$ns->create

Creates the namespace in Fluidinfo. Please note that namespaces are created on the fly by Fluidinfo if they do not exist.

Creating a namespace by hand may be useful for example if you want to change the inherited permissions right away. Other than that, it is recommended that you let Fluidinfo create namespaces as needed.

$ns->update

Updates the namespace in Fluidinfo. Only the description can be modified.

$ns->delete

Deletes the namespace in Fluidinfo.

$ns->description
$ns->description($description)

Gets/sets the description of the namespace.

Note that you need to set the description flag when you fetch a namespace for this attribute to be initialized.

$ns->namespace_names

Returns the names of the child namespaces as a (possibly empty) arrayref of strings.

Note that you need to set the namespace_names flag when you fetch a namespace for this attribute to be initialized.

$ns->tag_names

Returns the names of the child tags as a (possibly empty) arrayref of strings.

Note that you need to set the tag_names flag when you fetch a namespace for this attribute to initialized.

$ns->parent

The parent of the namespace, as an instance of Net::Fluidinfo::Namespace. This attribute is lazy loaded.

$ns->name

The name of the namespace.

$ns->path

The path of the namespace.

FLUIDINFO DOCUMENTATION

Fluidinfo high-level description

http://doc.fluidinfo.com/fluidDB/namespaces.html

Fluidinfo API documentation

http://doc.fluidinfo.com/fluidDB/api/namespaces-and-tags.html

Fluidinfo API specification

http://api.fluidinfo.com/fluidDB/api/*/namespaces/*

AUTHOR

Xavier Noria (FXN), <fxn@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2009-2011 Xavier Noria

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.