Aion
view release on metacpan or search on metacpan
lib/Aion/Meta/Feature.pm view on Meta::CPAN
=head1 SYNOPSIS
use Aion::Meta::Feature;
our $feature = Aion::Meta::Feature->new("My::Package", "my_feature" => (is => 'rw'));
$feature->stringify # => has my_feature => (is => 'rw') of My::Package
=head1 DESCRIPTION
Describes a feature that is added to the class by the C<has> function.
=head1 METHODS
=head2 pkg
ÐакеÑ, к коÑоÑÐ¾Ð¼Ñ Ð¾ÑноÑиÑÑÑ ÑиÑа.
$::feature->pkg # -> "My::Package"
=head2 name
Feature name.
$::feature->name # -> "my_feature"
=head2 opt
Feature options hash.
$::feature->opt # --> {is => 'rw'}
=head2 has
An array of feature options in the form of key-value pairs.
$::feature->has # --> ['is', 'rw']
=head2 construct
Feature constructor object.
ref $::feature->construct # \> Aion::Meta::FeatureConstruct
=head2 order()
The serial number of the feature in the class.
$::feature->order # -> 0
=head2 required (;$bool)
Flag for requiring a feature in the constructor (C<new>).
$::feature->required(1);
$::feature->required # -> 1
=head2 excessive (;$bool)
Feature redundancy flag in the constructor (C<new>). If it is there, an exception should be thrown.
$::feature->excessive(1);
$::feature->excessive # -> 1
=head2 isa (;Object[Aion::Type])
Type constraint on feature value.
use Aion::Type;
my $Int = Aion::Type->new(name => 'Int');
$::feature->isa($Int);
$::feature->isa # -> $Int
=head2 lazy (;$bool)
Lazy initialization flag.
$::feature->lazy(1);
$::feature->lazy # -> 1
=head2 builder (;$sub)
Feature value builder or C<undef>.
my $builder = sub {};
$::feature->builder($builder);
$::feature->builder # -> $builder
=head2 default (;$value)
Default value for the feature.
$::feature->default(42);
$::feature->default # -> 42
=head2 trigger (;$sub)
Event handler for feature value change or C<undef>.
my $trigger = sub {};
$::feature->trigger($trigger);
$::feature->trigger # -> $trigger
=head2 release (;$sub)
Event handler for reading a value from a feature or C<undef>.
my $release = sub {};
$::feature->release($release);
$::feature->release # -> $release
=head2 cleaner (;$sub)
Event handler for removing a feature from an object or C<undef>.
my $cleaner = sub {};
$::feature->cleaner($cleaner);
$::feature->cleaner # -> $cleaner
lib/Aion/Meta/Feature.pm view on Meta::CPAN
Flag for creating a writer method.
$::feature->make_writer(1);
$::feature->make_writer # -> 1
=head2 make_predicate (;$bool)
Flag for creating a predicate method.
$::feature->make_predicate(1);
$::feature->make_predicate # -> 1
=head2 make_clearer (;$bool)
Flag for creating a cleanup method.
$::feature->make_clearer(1);
$::feature->make_clearer # -> 1
=head2 new ($pkg, $name, @has)
Feature designer.
my $feature = Aion::Meta::Feature->new('My::Class', 'attr', is => 'ro', default => 1);
$feature->pkg # -> "My::Class"
$feature->name # -> "attr"
$feature->opt # --> {is => 'ro', default => 1}
=head2 stringify()
String representation of a feature.
$::feature->stringify # -> "has my_feature => (is => 'rw') of My::Package"
=head2 mk_property()
Creates a property accessor, getter, setter, predicate, and purifier.
package My::Package { use Aion }
$::feature->mk_property;
!!My::Package->can('my_feature') # -> 1
=head2 meta()
Returns code as text to access the feature's meta information.
$::feature->meta # \> $Aion::META{'My::Package'}{feature}{my_feature}
=head2 stash ($key; $val)
Access the property store for the calling package.
$::feature->stash('my_key', 'my_value');
$::feature->stash('my_key') # -> 'my_value'
=head2 compare ($other)
Compares the old feature with the rebooted one. If the C<isa> property is specified and does not match, an exception will be thrown.
=head1 AUTHOR
Yaroslav O. Kosmina L<mailto:dart@cpan.org>
=head1 LICENSE
â B<GPLv3>
=head1 COPYRIGHT
The Aion::Meta::Feature module is copyright © 2025 Yaroslav O. Kosmina. Rusland. All rights reserved.
( run in 1.069 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )