Data-IconText
view release on metacpan or search on metacpan
lib/Data/IconText.pm view on Meta::CPAN
56789101112131415161718192021222324# ABSTRACT: Work with icon text
package
Data::IconText;
use
v5.20;
use
strict;
use
warnings;
use
Carp;
use
Data::Identifier v0.12;
use
constant {
WK_UNICODE_CP
=> Data::Identifier->new(
uuid
=>
'5f167223-cc9c-4b2f-9928-9fe1b253b560'
)->register,
# unicode-code-point
WK_ASCII_CP
=> Data::Identifier->new(
uuid
=>
'f4b073ff-0b53-4034-b4e4-4affe5caf72c'
)->register,
# ascii-code-point
WK_FREEDESKTOP_ICON_NAME
=> Data::Identifier->new(
uuid
=>
'560906df-ebd1-41f6-b510-038b30522051'
)->register,
# freedesktop-icon-name
};
lib/Data/IconText.pm view on Meta::CPAN
666667668669670671672673674675676677678679680681682683684685686sub
attach {
my
(
$self
,
%opts
) =
@_
;
my
$weak
=
delete
$opts
{weak};
foreach
my
$key
(
keys
%_types
) {
my
$v
=
delete
$opts
{
$key
};
next
unless
defined
$v
;
croak
'Invalid type for key: '
.
$key
unless
eval
{
$v
->isa(
$_types
{
$key
})};
$self
->{
$key
} //=
$v
;
croak
'Missmatch for key: '
.
$key
unless
$self
->{
$key
} ==
$v
;
weaken(
$self
->{
$key
})
if
$weak
;
}
croak
'Stray options passed'
if
scalar
keys
%opts
;
return
$self
;
}
# ---- Private helpers ----
sub
_find_for_version_info {
my
(
$self
) =
@_
;
lib/Data/IconText.pm view on Meta::CPAN
846847848849850851852853854855856857858859860861862863864865A L<File::Information> object.
=item C<store>
A L<File::FStore> object.
=item C<weak>
Marks the value for all subobjects as weak.
If only a specific one needs needs to be weaken use L</attach>.
=back
=head2 unicode
my $unicode = $icontext->unicode;
This returns the numeric unicode value (e.g. 0x1F981) of the icon text.
If there is no single value associated with the icon text, this method C<die>s.
( run in 0.313 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )