NAME

Net::FluidDB::Tag - FluidDB tags

SYNOPSIS

use Net::FluidDB::Tag;

# create
$tag = Net::FluidDB::Tag->new(
   fdb         => $fdb,
   description => $description,
   indexed     => 1,
   path        => $path
);
$tag->create;

# get, optionally fetching descrition
$tag = Net::FluidDB::Tag->get($fdb, $path, description => 1);
$tag->namespace;

# update
$tag->description($new_description);
$tag->update;

# delete
$tag->delete;

DESCRIPTION

Net::FluidDB::Tag models FluidDB tags.

USAGE

Inheritance

Net::FluidDB::Tag is a subclass of Net::FluidDB::Base.

Roles

Net::FluidDB::Tag consumes the roles Net::FluidDB::HasObject, and Net::FluidDB::HasPath.

Class methods

Net::FluidDB::Tag->new(%attrs)

Constructs a new tag. The constructor accepts these parameters:

fdb (required)

An instance of Net::FluidDB.

description (optional)

A description of this tag.

indexed (required)

A flag that tells FluidDB whether this tag should be indexed.

namespace (optional, but dependent)

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

name (optional, but dependent)

The name of the tag, which is the rightmost segment of its path. The name of "fxn/rating" is "rating".

path (optional, but dependent)

The path of the tag, for example "fxn/rating".

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

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

This constructor is only useful for creating new tags in FluidDB. Existing tags are fetched with get.

Net::FluidDB::Tag->get($fdb, $path, %opts)

Retrieves the tag with path $path from FluidDB. Options are:

description (optional, default false)

Tells get whether you want to fetch the description.

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

Net::FluidDB::Tag->equal_paths($path1, $path2)

Determines whether $path1 and $path2 are the same in FluidDB. The basic rule is that the username fragment is case-insensitive, and the rest is not.

Instance Methods

$tag->create

Creates the tag in FluidDB.

$tag->update

Updates the tag in FluidDB. Only the description can be modified.

$tag->delete

Deletes the tag in FluidDB.

$tag->description
$tag->description($description)

Gets/sets the description of the tag.

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

$tag->indexed

A flag, indicates whether this tag is indexed in FluidDB.

$tag->namespace

The namespace the tag belongs to, as an instance of Net::FluidDB::Namespace. This attribute is lazy loaded.

$tag->name

The name of the tag.

$tag->path

The path of the tag.

FLUIDDB DOCUMENTATION

FluidDB high-level description

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

FluidDB API documentation

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

FluidDB API specification

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

AUTHOR

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

COPYRIGHT AND LICENSE

Copyright (C) 2009-2010 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.