Why not adopt me?
NAME
Net::Fluidinfo::Tag - Fluidinfo tags
SYNOPSIS
use Net::Fluidinfo::Tag;
# create
$tag = Net::Fluidinfo::Tag->new(
fin => $fin,
description => $description,
indexed => 1,
path => $path
);
$tag->create;
# get, optionally fetching descrition
$tag = Net::Fluidinfo::Tag->get($fin, $path, description => 1);
$tag->namespace;
# update
$tag->description($new_description);
$tag->update;
# delete
$tag->delete;
DESCRIPTION
Net::Fluidinfo::Tag
models Fluidinfo tags.
USAGE
Inheritance
Net::Fluidinfo::Tag
is a subclass of Net::Fluidinfo::Base.
Roles
Net::Fluidinfo::Tag
consumes the roles Net::Fluidinfo::HasObject, and Net::Fluidinfo::HasPath.
Class methods
- Net::Fluidinfo::Tag->new(%attrs)
-
Constructs a new tag. The constructor accepts these parameters:
- fin (required)
-
An instance of Net::Fluidinfo.
- description (optional)
-
A description of this tag.
- indexed (required)
-
A flag that tells Fluidinfo whether this tag should be indexed. This attribute mirrors the Fluidinfo API, but please note that Fluidinfo currently ignores its value, nowadays all tags are indexed.
- namespace (optional, but dependent)
-
The namespace you want to put this tag into. An instance of Net::Fluidinfo::Namespace representing an existing namespace in Fluidinfo.
- 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 Fluidinfo allows fetching tags without their description. It must be defined when creating or updating tags though.The attributes
namespace
,path
, andname
are mutually dependent. Ultimately tag creation has to be able to send the path of the namespace and the name of the tag to Fluidinfo. So you can setnamespace
andname
, or justpath
.This constructor is only useful for creating new tags in Fluidinfo. Existing tags are fetched with
get
. - Net::Fluidinfo::Tag->get($fin, $path, %opts)
-
Retrieves the tag with path
$path
from Fluidinfo. Options are:Net::Fluidinfo
provides a convenience shortcut for this method. - Net::Fluidinfo::Tag->equal_paths($path1, $path2)
-
Determines whether
$path1
and$path2
are the same in Fluidinfo. The basic rule is that the username fragment is case-insensitive, and the rest is not.
Instance Methods
- $tag->create
-
Creates the tag in Fluidinfo. Please note that tags are created on the fly by Fluidinfo if they do not exist.
Creating a tag by hand may be useful for example if you want to change the inherited permissions right away. That may be interesting if you are going to store sensitive data that would be by default readable. Other than that, it is recommended that you let Fluidinfo create tags as needed.
- $tag->update
-
Updates the tag in Fluidinfo. Only the description can be modified.
- $tag->delete
-
Deletes the tag in Fluidinfo.
- $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 Fluidinfo.
This predicate mirrors the Fluidinfo API. Nowadays all tags are indexed, so this predicate returns always true.
- $tag->namespace
-
The namespace the tag belongs to, as an instance of Net::Fluidinfo::Namespace. This attribute is lazy loaded.
- $tag->name
-
The name of the tag.
- $tag->path
-
The path of the tag.
FLUIDINFO DOCUMENTATION
- Fluidinfo high-level description
- Fluidinfo API documentation
-
http://doc.fluidinfo.com/fluidDB/api/namespaces-and-tags.html
- Fluidinfo API specification
AUTHOR
Xavier Noria (FXN), <fxn@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2009-2012 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.