view release on metacpan or search on metacpan
* `ro` â ÑоздаÑÑ ÑолÑко геÑÑеÑ.
* `wo` â ÑоздаÑÑ ÑолÑко ÑеÑÑеÑ.
* `rw` â ÑоздаÑÑ Ð³ÐµÑÑÐµÑ Ð¸ ÑеÑÑеÑ.
Ðо ÑмолÑÐ°Ð½Ð¸Ñ â `rw`.
ÐополниÑелÑнÑе ÑазÑеÑениÑ:
* `+` â ÑиÑа обÑзаÑелÑна в паÑамеÑÑаÑ
конÑÑÑÑкÑоÑа. `+` не иÑполÑзÑеÑÑÑ Ñ `-`.
* `-` â ÑиÑа не Ð¼Ð¾Ð¶ÐµÑ Ð±ÑÑÑ ÑÑÑановлена ÑеÑез конÑÑÑÑкÑоÑ. '-' не иÑполÑзÑеÑÑÑ Ñ `+`.
* `*` â не инкÑеменÑиÑоваÑÑ ÑÑÑÑÑик ÑÑÑлок на знаÑение (пÑимениÑÑ `weaken` к знаÑÐµÐ½Ð¸Ñ Ð¿Ð¾Ñле ÑÑÑановки его в ÑиÑÑ).
* `?` â ÑоздаÑÑ Ð¿ÑедикаÑ.
* `!` â ÑоздаÑÑ clearer.
```perl
package ExIs { use Aion;
has rw => (is => 'rw?!');
has ro => (is => 'ro+');
has wo => (is => 'wo-?');
}
i18n/Aion.ru-en.po view on Meta::CPAN
msgid "Ðо ÑмолÑÐ°Ð½Ð¸Ñ â `rw`."
msgstr "By default - `rw`."
msgid "ÐополниÑелÑнÑе ÑазÑеÑениÑ:"
msgstr "Additional permits:"
msgid ""
"* `+` â ÑиÑа обÑзаÑелÑна в паÑамеÑÑаÑ
конÑÑÑÑкÑоÑа. `+` не иÑполÑзÑеÑÑÑ Ñ `-`.\n"
"* `-` â ÑиÑа не Ð¼Ð¾Ð¶ÐµÑ Ð±ÑÑÑ ÑÑÑановлена ÑеÑез конÑÑÑÑкÑоÑ. '-' не иÑполÑзÑеÑÑÑ Ñ `+`.\n"
"* `*` â не инкÑеменÑиÑоваÑÑ ÑÑÑÑÑик ÑÑÑлок на знаÑение (пÑимениÑÑ `weaken` к знаÑÐµÐ½Ð¸Ñ Ð¿Ð¾Ñле ÑÑÑановки его в ÑиÑÑ).\n"
"* `?` â ÑоздаÑÑ Ð¿ÑедикаÑ.\n"
"* `!` â ÑоздаÑÑ clearer."
msgstr ""
"* `+` â the feature is required in the constructor parameters. `+` is not used with `-`.\n"
"* `-` â the feature cannot be installed via the constructor. '-' is not used with `+`.\n"
"* `*` â do not increment the value's reference counter (apply `weaken` to the value after installing it in the feature).\n"
"* `?` â create a predicate.\n"
"* `!` â create clearer."
msgid "ФÑнкÑÐ¸Ñ Ñ `*` не ÑдеÑÐ¶Ð¸Ð²Ð°ÐµÑ Ð·Ð½Ð°Ñение:"
msgstr "The function with `*` does not hold the meaning:"
msgid "УказÑÐ²Ð°ÐµÑ Ñип, а ÑоÑнее â валидаÑоÑ, ÑиÑи."
msgstr "Indicates the type, or rather - a validator, feature."
msgid "ÐÐ¾Ð¶ÐµÑ Ð¿ÑинимаÑÑ:"
i18n/Aion/Meta/FeatureConstruct.ru-en.po view on Meta::CPAN
msgid "## has\n"
"Ðод пÑовеÑки ÑÑÑеÑÑÐ²Ð¾Ð²Ð°Ð½Ð¸Ñ Ð·Ð½Ð°ÑениÑ. ÐкÑеÑÑоÑ."
msgstr "##has\n"
"Code for checking the existence of a value. Accessor."
msgid "## clear\n"
"Ðод ÑÐ´Ð°Ð»ÐµÐ½Ð¸Ñ Ð·Ð½Ð°ÑениÑ. ÐкÑеÑÑоÑ."
msgstr "## clear\n"
"Code for deleting a value. Accessor."
msgid "## weaken\n"
"Ðод оÑÐ»Ð°Ð±Ð»ÐµÐ½Ð¸Ñ ÑÑÑлки. ÐкÑеÑÑоÑ."
msgstr "## weaken\n"
"Link weakening code. Accessor."
msgid "## accessor_name\n"
"ÐÐ¼Ñ Ð¼ÐµÑода-акÑеÑÑоÑа. ÐкÑеÑÑоÑ."
msgstr "## accessor_name\n"
"The name of the accessor method. Accessor."
msgid "## reader_name\n"
"ÐÐ¼Ñ Ð¼ÐµÑода-ÑидеÑа. ÐкÑеÑÑоÑ."
msgstr "## reader_name\n"
"Reader method name. Accessor."
lib/Aion.md view on Meta::CPAN
* `ro` â ÑоздаÑÑ ÑолÑко геÑÑеÑ.
* `wo` â ÑоздаÑÑ ÑолÑко ÑеÑÑеÑ.
* `rw` â ÑоздаÑÑ Ð³ÐµÑÑÐµÑ Ð¸ ÑеÑÑеÑ.
Ðо ÑмолÑÐ°Ð½Ð¸Ñ â `rw`.
ÐополниÑелÑнÑе ÑазÑеÑениÑ:
* `+` â ÑиÑа обÑзаÑелÑна в паÑамеÑÑаÑ
конÑÑÑÑкÑоÑа. `+` не иÑполÑзÑеÑÑÑ Ñ `-`.
* `-` â ÑиÑа не Ð¼Ð¾Ð¶ÐµÑ Ð±ÑÑÑ ÑÑÑановлена ÑеÑез конÑÑÑÑкÑоÑ. '-' не иÑполÑзÑеÑÑÑ Ñ `+`.
* `*` â не инкÑеменÑиÑоваÑÑ ÑÑÑÑÑик ÑÑÑлок на знаÑение (пÑимениÑÑ `weaken` к знаÑÐµÐ½Ð¸Ñ Ð¿Ð¾Ñле ÑÑÑановки его в ÑиÑÑ).
* `?` â ÑоздаÑÑ Ð¿ÑедикаÑ.
* `!` â ÑоздаÑÑ clearer.
```perl
package ExIs { use Aion;
has rw => (is => 'rw?!');
has ro => (is => 'ro+');
has wo => (is => 'wo-?');
}
lib/Aion.pm view on Meta::CPAN
sub is_aspect {
my ($is, $feature) = @_;
die "Use is => '{ro|rw|wo|no} {+|-} {*} {?} {!}'" if $is !~ /^(?<access>ro|rw|wo|no)?(?<require>[+-])?(?<weak>\*)?(?<has>\??)(?<clear>!?)\z/;
my ($construct, $name) = @$feature{qw/construct name/};
$construct->getter("die 'Feature $name cannot be get!';") if $+{access} ~~ [qw/wo no/];
$construct->setter("die 'Feature $name cannot be set!';") if $+{access} ~~ [qw/ro no/];
$construct->add_trigger("%(weaken)s") if $+{weak};
$feature->{required} = 1, $construct->not_specified(' else { die "%(init_arg)s required!" }') if $+{require} eq '+';
$feature->{excessive} = 1, $construct->initer('die "%(init_arg)s excessive!"') if $+{require} eq '-';
$feature->{make_predicate} = 1 if $+{has};
$feature->{make_clearer} = 1 if $+{clear};
}
# isa => Type
lib/Aion.pm view on Meta::CPAN
By default - C<rw>.
Additional permits:
=over
=item * C<+> â the feature is required in the constructor parameters. C<+> is not used with C<->.
=item * C<-> â the feature cannot be installed via the constructor. '-' is not used with C<+>.
=item * C<*> â do not increment the value's reference counter (apply C<weaken> to the value after installing it in the feature).
=item * C<?> â create a predicate.
=item * C<!> â create clearer.
=back
package ExIs { use Aion;
has rw => (is => 'rw?!');
has ro => (is => 'ro+');
lib/Aion/Meta/FeatureConstruct.md view on Meta::CPAN
$::construct->has # \> exists $self->{%(name)s}
```
## clear
Ðод ÑÐ´Ð°Ð»ÐµÐ½Ð¸Ñ Ð·Ð½Ð°ÑениÑ. ÐкÑеÑÑоÑ.
```perl
$::construct->clear # \> delete $self->{%(name)s}
```
## weaken
Ðод оÑÐ»Ð°Ð±Ð»ÐµÐ½Ð¸Ñ ÑÑÑлки. ÐкÑеÑÑоÑ.
```perl
$::construct->weaken # \> Scalar::Util::weaken(%(get)s);
```
## accessor_name
ÐÐ¼Ñ Ð¼ÐµÑода-акÑеÑÑоÑа. ÐкÑеÑÑоÑ.
```perl
$::construct->accessor_name # \> %(name)s
```
## reader_name
lib/Aion/Meta/FeatureConstruct.pm view on Meta::CPAN
use Aion::Meta::Util qw//;
Aion::Meta::Util::create_getters(qw/
pkg name
write read
getvar ret
/);
Aion::Meta::Util::create_accessors(qw/
init_arg
set get has clear weaken
accessor_name reader_name writer_name predicate_name clearer_name
initer not_specified
getter setter selfret
/);
# ÐонÑÑÑÑкÑоÑ
sub new {
my ($cls, $pkg, $name) = @_;
bless {
lib/Aion/Meta/FeatureConstruct.pm view on Meta::CPAN
getvar => '%(get)s',
get => '$self->{%(name)s}',
release => '',
ret => '',
predicate_name => 'has_%(name)s',
has => 'exists $self->{%(name)s}',
clearer_name => 'clear_%(name)s',
clear => 'delete $self->{%(name)s}',
clearret => '$self',
cleaner => '',
weaken => 'Scalar::Util::weaken(%(get)s);',
}, ref $cls || $cls;
}
sub add_attr { shift->_expand('attr', @_) }
sub add_preset { shift->_expand('preset', @_) }
sub add_trigger { shift->_expand('trigger', @_) }
sub add_cleaner { shift->_expand('cleaner', @_) }
sub add_access { shift->_expand('access', @_) }
sub add_release {
my $self = shift;
lib/Aion/Meta/FeatureConstruct.pm view on Meta::CPAN
Code for checking the existence of a value. Accessor.
$::construct->has # \> exists $self->{%(name)s}
=head2 clear
Code for deleting a value. Accessor.
$::construct->clear # \> delete $self->{%(name)s}
=head2 weaken
Link weakening code. Accessor.
$::construct->weaken # \> Scalar::Util::weaken(%(get)s);
=head2 accessor_name
The name of the accessor method. Accessor.
$::construct->accessor_name # \> %(name)s
=head2 reader_name
Reader method name. Accessor.
lib/Aion/Meta/Subroutine.pm view on Meta::CPAN
Sub::Util::set_prototype Sub::Util::prototype($referent), $sub;
Sub::Util::set_subname Sub::Util::subname($referent), $sub;
*{"$pkg\::$subname"} = $sub if $subname ne '__ANON__';
$self->{wrapsub} = $sub;
$Aion::META{$pkg}{subroutine}{$subname} = $self;
my $key = pack 'J', Scalar::Util::refaddr $sub;
$Aion::Isa{$key} = $self;
Scalar::Util::weaken $Aion::Isa{$key};
$self
}
sub compare {
my ($self, $subroutine) = @_;
die "Requires subroutine ${\$self->name}" unless $subroutine->isa('Aion::Meta::Subroutine');
my $i = 0;
# * `ro` â ÑоздаÑÑ ÑолÑко геÑÑеÑ.
# * `wo` â ÑоздаÑÑ ÑолÑко ÑеÑÑеÑ.
# * `rw` â ÑоздаÑÑ Ð³ÐµÑÑÐµÑ Ð¸ ÑеÑÑеÑ.
#
# Ðо ÑмолÑÐ°Ð½Ð¸Ñ â `rw`.
#
# ÐополниÑелÑнÑе ÑазÑеÑениÑ:
#
# * `+` â ÑиÑа обÑзаÑелÑна в паÑамеÑÑаÑ
конÑÑÑÑкÑоÑа. `+` не иÑполÑзÑеÑÑÑ Ñ `-`.
# * `-` â ÑиÑа не Ð¼Ð¾Ð¶ÐµÑ Ð±ÑÑÑ ÑÑÑановлена ÑеÑез конÑÑÑÑкÑоÑ. '-' не иÑполÑзÑеÑÑÑ Ñ `+`.
# * `*` â не инкÑеменÑиÑоваÑÑ ÑÑÑÑÑик ÑÑÑлок на знаÑение (пÑимениÑÑ `weaken` к знаÑÐµÐ½Ð¸Ñ Ð¿Ð¾Ñле ÑÑÑановки его в ÑиÑÑ).
# * `?` â ÑоздаÑÑ Ð¿ÑедикаÑ.
# * `!` â ÑоздаÑÑ clearer.
#
::done_testing; }; subtest 'is => $permissions' => sub {
package ExIs { use Aion;
has rw => (is => 'rw?!');
has ro => (is => 'ro+');
has wo => (is => 'wo-?');
}
t/aion/meta/feature-construct.t view on Meta::CPAN
local ($::_g0 = do {$::construct->has}, $::_e0 = 'exists $self->{%(name)s}'); ::ok $::_g0 eq $::_e0, '$::construct->has # \> exists $self->{%(name)s}' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ## clear
# Ðод ÑÐ´Ð°Ð»ÐµÐ½Ð¸Ñ Ð·Ð½Ð°ÑениÑ. ÐкÑеÑÑоÑ.
#
::done_testing; }; subtest 'clear' => sub {
local ($::_g0 = do {$::construct->clear}, $::_e0 = 'delete $self->{%(name)s}'); ::ok $::_g0 eq $::_e0, '$::construct->clear # \> delete $self->{%(name)s}' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ## weaken
# Ðод оÑÐ»Ð°Ð±Ð»ÐµÐ½Ð¸Ñ ÑÑÑлки. ÐкÑеÑÑоÑ.
#
::done_testing; }; subtest 'weaken' => sub {
local ($::_g0 = do {$::construct->weaken}, $::_e0 = 'Scalar::Util::weaken(%(get)s);'); ::ok $::_g0 eq $::_e0, '$::construct->weaken # \> Scalar::Util::weaken(%(get)s);' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ## accessor_name
# ÐÐ¼Ñ Ð¼ÐµÑода-акÑеÑÑоÑа. ÐкÑеÑÑоÑ.
#
::done_testing; }; subtest 'accessor_name' => sub {
local ($::_g0 = do {$::construct->accessor_name}, $::_e0 = '%(name)s'); ::ok $::_g0 eq $::_e0, '$::construct->accessor_name # \> %(name)s' or ::diag ::_string_diff($::_g0, $::_e0); undef $::_g0; undef $::_e0;
#
# ## reader_name