NAME
Lingua::famibeib::Modifier - module to interact with the famibeib word modifiers
VERSION
version v0.01
SYNOPSIS
use Lingua::famibeib::Modifier;
This package represents a modifier that is applied to a word. See also Lingua::famibeib::Word.
This module inherits from Data::Identifier::Interface::Simple, and Data::Identifier::Interface::Subobjects. Instances are overloaded so they will stringify to their string representation as per "as_string".
new
my Lingua::famibeib::Modifier $modifier = Lingua::famibeib::Modifier->new($type => $value);
# e.g.:
my Lingua::famibeib::Modifier $modifier = Lingua::famibeib::Modifier->new(string => 'ik');
(since v0.01)
Creates a new modifier instance. A modifier is the part of a word that is not it's stem.
Currently the following types ($type) are supported:
from-
Constructs a word from an object. If the
$valueshould be a reference.Currently references to the following types are supported: Data::Identifier, Data::Identifier::Interface::Simple, Data::URIID::Base, and Lingua::famibeib::Modifier. More types might be supported. If
$valueis not a reference the value is parsed as perstring. string-
Constructs a modifier from a string.
as_string
my $str = $modifier->as_string;
(since v0.01)
Returns the current modifier as a string.
master_mora
my $str = $modifier->master_mora;
(experimental since v0.01)
Returns the master mora from the modifier. This is the first mora of the modifier. It provides the type of the modifier.
eq
my $bool = $modifier->eq($other); # $modifier must be non-undef
# or:
my $bool = Lingua::famibeib::Modifier::eq($modifier, $other); # $modifier can be undef
(since v0.01)
Compares two modifier to be equal.
If both modifier are undef they are considered equal.
If $modifier or $other is not an instance of Lingua::famibeib::Modifier or undef "new" with the type from is used.
The operators "eq" in perlop and "ne" in perlop are overloaded to this method.
cmp
my $val = $modifier->cmp($other); # $modifier must be non-undef
# or:
my $val = Lingua::famibeib::Modifier::cmp($modifier, $other); # $modifier can be undef
(experimental since v0.01)
Compares the modifier similar to cmp. This method can be used to order modifier. To check for them to be equal see "eq".
The parameters are parsed the same way as "eq".
The operator "cmp" in perlop is overloaded to this method.
If this method is used for sorting the exact resulting order is not defined. However:
The order is stable
The order is the same for
$a->cmp($b)as for- $b->cmp($a).
register
$modifier->register;
(since v0.01)
Registers the modifier with this module. A registered modifier will be kept in memory indefinitely. It is used for deduplication and some types of lookups.
This method will return $modifier. This can be used to build constants.
Note: Calling this multiple times on the same modifier is fine. However, doing so might waste some time.
Note: Base and common modifiers are already registered by this module. Hence it is hardly needed to call this method at all.
AUTHOR
Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2025 by Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)