Why not adopt me?
NAME
Net::FluidDB::Namespace - FluidDB namespaces
SYNOPSIS
use Net::FluidDB::Namespace;
# create
$ns = Net::FluidDB::Namespace->new(
fdb => $fdb,
description => $description,
path => $path
);
$ns->create;
# get, optionally fetching descrition
$ns = Net::FluidDB::Namespace->get($fdb, $path, description => 1);
$ns->parent;
# update
$ns->description($new_description);
$ns->update;
# delete
$ns->delete;
DESCRIPTION
Net::FluidDB::Namespace
models FluidDB namespaces.
USAGE
Inheritance
Net::FluidDB::Namespace
is a subclass of Net::FluidDB::Base.
Roles
Net::FluidDB::Namespace
consumes the roles Net::FluidDB::HasObject, and Net::FluidDB::HasPath.
Class methods
- Net::FluidDB::Namespace->new(%attrs)
-
Constructs a new namespace. The constructor accepts these parameters:
- fdb (required)
-
An instance of Net::FluidDB.
- description (optional)
-
A description of this namespace.
- parent (optional, but dependent)
-
The namespace you want to put this namespace into. An instance of Net::FluidDB::Namespace representing an existing namespace in FluidDB.
- 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 FluidDB allows fetching namespaces without their description. It must be defined when creating or updating namespaces though.The attributes
parent
,path
, andname
are mutually dependent. Ultimately namespace creation has to be able to send the path of the parent and the name of the namespace to FluidDB. So you can setparent
andname
, or justpath
.This constructor is only useful for creating new namespaces in FluidDB. Existing namespaces are fetched with
get
. - Net::FluidDB::Namespace->get($fdb, $path, %opts)
-
Retrieves the namespace with path
$path
from FluidDB. 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::FluidDB
provides a convenience shortcut for this method.
Instance Methods
- $ns->create
-
Creates the namespace in FluidDB.
- $ns->update
-
Updates the namespace in FluidDB. Only the description can be modified.
- $ns->delete
-
Deletes the namespace in FluidDB.
- $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::FluidDB::Namespace. This attribute is lazy loaded.
- $ns->name
-
The name of the namespace.
- $ns->path
-
The path of the namespace.
FLUIDDB DOCUMENTATION
- FluidDB high-level description
- FluidDB API documentation
-
http://doc.fluidinfo.com/fluidDB/api/namespaces-and-tags.html
- FluidDB API specification
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.