NAME

Data::TagDB::Tag - Work with Tag databases

VERSION

version v0.11

SYNOPSIS

use Data::TagDB;

my $db = Data::TagDB->new(...);

my Data::TagDB::Tag $tag = $db->tag_by_...(...);

This package represents a single tag in the database.

This package inherits from Data::Identifier::Interface::Simple (since v0.11).

UNIVERSAL OPTIONS

The following universe options are supported by many methods of this module. Each method lists which universal options it supports.

default

The default value to be returned if no value could be found. Can be undef to switch the method from dieing to returning undef in case no value is found.

no_defaults

Prevents the calculation of any fallback values.

METHODS

db

my Data::TagDB $db = $tag->db;

Returns the current Data::TagDB object.

dbid

my $dbid = $db->dbid;

Returns the current tag's database internal identifier. This call should be avoided as those identifiers are not stable nor portable. It is however the best option when directly interacting with the backend database.

uuid, oid, uri, sid

my     $uuid = $tag->uuid( [ %opts ] );
my     $oid  = $tag->oid( [ %opts ] );
my URI $uri  = $tag->uri( [ %opts ] );
my     $sid  = $tag->sid( [ %opts ] );

Returns the tags UUID, OID, URI, or SID (small-identifier). Identifiers may also be unavailable due to being not part of the database.

The following universal options are supported: "default", "no_defaults".

ise

my $ise = $tag->ise( [ %opts ] );

Returns an identifier (uuid, oid, or uri) for the tag as string.

Supports the same options as supported by "uuid", "oid", and "uri".

displayname

my $displayname = $tag->displayname( [ %opts ] );

Returns a name that can be used to display to the user or dies. This function always returns a plain string (even if no usable name is found) unless "no_defaults" is given.

The following universal options are supported: "default", "no_defaults".

displaycolour

my $displaycolour = $tag->displaycolour( [ %opts ] );

Returns a colour that can be used to display the tag. This will return a decoded object, most likely (but not necessarily) an instance of Data::URIID::Colour. Later versions of this module may allow to force a specific type.

This method dies if no value can be found and no "default" is given (since v0.11).

The following universal options are supported: "default". The following universal options are ignored (without warning or error): "no_defaults".

icontext

my $icontext = $tag->icontext( [ %opts ] );

Returns a string that is a single unicode character that represents the tag. This can be used as a visual aid for the user. It is not well defined what single character means in this case. A single character may map to multiple unicode code points (such as a base and modifiers). If the application requies a specific definition of single character it must validate the value.

This method dies if no value can be found and no "default" is given (since v0.11).

The following universal options are supported: "default". The following universal options are ignored (without warning or error): "no_defaults".

description

my $description = $tag->description( [ %opts ] );

Returns a description that can be used to display to the user.

This method dies if no value can be found and no "default" is given (since v0.11).

The following universal options are supported: "default". The following universal options are ignored (without warning or error): "no_defaults".

cloudlet

my Data::TagDB::Cloudlet $cl = $tag->cloudlet($which);

Experimental: Gets the given cloudlet.

Note: This method is experimental. It may change prototype, and behaviour or may be removed in future versions without warning.

AUTHOR

Philipp Schafft <lion@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2024-2025 by Philipp Schafft <lion@cpan.org>.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)