Data-TagDB
view release on metacpan or search on metacpan
lib/Data/TagDB/Tag.pm view on Meta::CPAN
The following universe options are supported by many methods of this module. Each method lists which universal options it supports.
=head2 default
The default value to be returned if no value could be found.
Can be C<undef> to switch the method from C<die>ing to returning C<undef> in case no value is found.
=head2 no_defaults
Prevents the calculation of any fallback values.
=head1 METHODS
=head2 db
my Data::TagDB $db = $tag->db;
Returns the current L<Data::TagDB> object.
=head2 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.
=head2 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: L</default>, L</no_defaults>.
=head2 ise
my $ise = $tag->ise( [ %opts ] );
Returns an identifier (C<uuid>, C<oid>, or C<uri>) for the tag as string.
Supports the same options as supported by L</uuid>, L</oid>, and L</uri>.
=head2 displayname
my $displayname = $tag->displayname( [ %opts ] );
Returns a name that can be used to display to the user or C<die>s.
This function always returns a plain string (even if no usable name is found) unless L</no_defaults> is given.
The following universal options are supported: L</default>, L</no_defaults>.
=head2 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 L<Data::URIID::Colour>.
Later versions of this module may allow to force a specific type.
This method C<die>s if no value can be found and no L</default> is given (since v0.11).
The following universal options are supported: L</default>.
The following universal options are ignored (without warning or error): L</no_defaults>.
=head2 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 C<die>s if no value can be found and no L</default> is given (since v0.11).
The following universal options are supported: L</default>.
The following universal options are ignored (without warning or error): L</no_defaults>.
=head2 description
my $description = $tag->description( [ %opts ] );
Returns a description that can be used to display to the user.
This method C<die>s if no value can be found and no L</default> is given (since v0.11).
The following universal options are supported: L</default>.
The following universal options are ignored (without warning or error): L</no_defaults>.
=head2 cloudlet
my Data::TagDB::Cloudlet $cl = $tag->cloudlet($which);
B<Experimental:>
Gets the given cloudlet.
B<Note:>
This method is experimental. It may change prototype, and behaviour or may be removed in future versions without warning.
=head1 AUTHOR
Philipp Schafft <lion@cpan.org>
=head1 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)
=cut
( run in 1.043 second using v1.01-cache-2.11-cpan-600a1bdf6e4 )